From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIHSd-0002hu-Hq for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:31:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIHSY-0008Iz-EU for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:31:30 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:60534) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIHSY-0008IY-6o for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:31:26 -0400 Date: Wed, 29 Jun 2016 11:31:24 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <981859396.766716.1467214284491.JavaMail.zimbra@redhat.com> In-Reply-To: <1467213840-14206-3-git-send-email-pbonzini@redhat.com> References: <1467213840-14206-1-git-send-email-pbonzini@redhat.com> <1467213840-14206-3-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PULL 32/35] vhost-user: disable chardev handlers on close List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Hi ----- Original Message ----- > This otherwise causes a use-after-free if network backend cleanup > is performed before character device cleanup. >=20 > Cc: Marc-Andr=C3=A9 Lureau > Signed-off-by: Paolo Bonzini See also my previous (still unreviewed) series: https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg01004.html so: Reviewed-by: Marc-Andr=C3=A9 Lureau > --- > net/vhost-user.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/net/vhost-user.c b/net/vhost-user.c > index 636899a..92f4cfd 100644 > --- a/net/vhost-user.c > +++ b/net/vhost-user.c > @@ -151,6 +151,11 @@ static void vhost_user_cleanup(NetClientState *nc) > vhost_net_cleanup(s->vhost_net); > s->vhost_net =3D NULL; > } > + if (s->chr) { > + qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL); > + qemu_chr_fe_release(s->chr); > + s->chr =3D NULL; > + } > =20 > qemu_purge_queued_packets(nc); > } > -- > 1.8.3.1 >=20