From: Huai Huang<h158...@126.com>
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index f2d49ad..4037cf4 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -412,7 +412,6 @@ VHostNetState *get_vhost_net(NetClientState *nc) break; case NET_CLIENT_DRIVER_VHOST_USER: vhost_net = vhost_user_get_vhost_net(nc); - assert(vhost_net); break; default: break; diff --git a/net/vhost-user.c b/net/vhost-user.c index b0595f8..4e54478 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -160,7 +160,10 @@ static void vhost_user_cleanup(NetClientState *nc) qemu_chr_fe_release(s->chr); s->chr = NULL; } - + if (s->watch) { + g_source_remove(s->watch); + s->watch = 0; + } qemu_purge_queued_packets(nc); } @@ -192,7 +195,8 @@ static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond, { VhostUserState *s = opaque; - qemu_chr_disconnect(s->chr); + if (s->chr) + qemu_chr_disconnect(s->chr); return FALSE; }