[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] vhost-user: fix crash when chardev-remove
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] vhost-user: fix crash when chardev-remove |
Date: |
Wed, 11 Jan 2017 15:02:26 +0000 |
Hi
On Wed, Jan 11, 2017 at 3:32 PM 黄淮 <address@hidden> wrote:
> From: Huai Huang<address@hidden>
>
>
>
Could you describe a bit more the crash and provide a backtrace?
> 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);
>
This was recently added, in commit
1a5b68cee8a2b165ffd61b2e0641a4da3990f242.
How is it related?
I remember the rest of the vhost-user code expected get_vhost_net() to be
non-null, did that change?
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;
> + }
>
Hmm, the socket didn't send a CLOSED event on remove?
> 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);
>
that looks outdated,
which version of qemu did you tested and patched?
thanks
>
>
> return FALSE;
> }
--
Marc-André Lureau