From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIFXi-0006xq-Rb for qemu-devel@nongnu.org; Wed, 29 Jun 2016 09:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIFXe-0002RC-HV for qemu-devel@nongnu.org; Wed, 29 Jun 2016 09:28:37 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIFXe-0002Qh-B8 for qemu-devel@nongnu.org; Wed, 29 Jun 2016 09:28:34 -0400 Received: by mail-wm0-x241.google.com with SMTP id c82so14411548wme.3 for ; Wed, 29 Jun 2016 06:28:34 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 29 Jun 2016 15:28:25 +0200 Message-Id: <1467206906-38060-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] vhost-user: disable chardev handlers on close List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= This otherwise causes a use-after-free if network backend cleanup is performed before character device cleanup. Cc: Marc-André Lureau Signed-off-by: Paolo Bonzini --- I'm including this in the pull request too. net/vhost-user.c | 5 +++++ 1 file changed, 5 insertions(+) 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 = NULL; } + if (s->chr) { + qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL); + qemu_chr_fe_release(s->chr); + s->chr = NULL; + } qemu_purge_queued_packets(nc); } -- 1.8.3.1