提交 d8a919ff 编写于 作者: L linzhecheng 提交者: Michael Roth

vhost-user: delete net client if necessary

As qemu_new_net_client create new ncs but error happens later,
ncs will be left in global net_clients list and we can't use them any
more, so we need to cleanup them.

Cc: qemu-stable@nongnu.org
Signed-off-by: Nlinzhecheng <linzhecheng@huawei.com>
Signed-off-by: NJason Wang <jasowang@redhat.com>
(cherry picked from commit c67daf4a)
 Conflicts:
	net/vhost-user.c
* drop functional dep on 4d0cf552Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 f4e93bbd
......@@ -296,7 +296,7 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
s = DO_UPCAST(VhostUserState, nc, nc);
if (!qemu_chr_fe_init(&s->chr, chr, &err)) {
error_report_err(err);
return -1;
goto err;
}
}
......@@ -306,7 +306,7 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
do {
if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) {
error_report_err(err);
return -1;
goto err;
}
qemu_chr_fe_set_handlers(&s->chr, NULL, NULL,
net_vhost_user_event, NULL, nc0->name, NULL,
......@@ -316,6 +316,13 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
assert(s->vhost_net);
return 0;
err:
if (nc0) {
qemu_del_net_client(nc0);
}
return -1;
}
static Chardev *net_vhost_claim_chardev(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册