提交 e0a039e5 编写于 作者: Z zhanghailiang 提交者: Jason Wang

filter-buffer: fix segfault when starting qemu with status=off property

After commit 338d3f, we support 'status' property for filter object.
The segfault can be triggered by starting qemu with 'status=off' property
for filter, when the s->incoming_queue is NULL, we reference it directly
in qemu_net_queue_flush() which was called in status_changed() callback
function.

We shouldn't trigger status_changed() before the filter was initialized,
We can check the value of 'nf->netdev' to confirm if the filter is
initialized or not, so let's check its value before calling
status_changed().
Signed-off-by: Nzhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: NJason Wang <jasowang@redhat.com>
上级 91731d5f
......@@ -164,7 +164,7 @@ static void netfilter_set_status(Object *obj, const char *str, Error **errp)
return;
}
nf->on = !nf->on;
if (nfc->status_changed) {
if (nf->netdev && nfc->status_changed) {
nfc->status_changed(nf, errp);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册