From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V55V3-0006VR-RL for qemu-devel@nongnu.org; Thu, 01 Aug 2013 22:53:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V55Pi-00063Q-Cl for qemu-devel@nongnu.org; Thu, 01 Aug 2013 22:48:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4tDk-0006dE-HZ for qemu-devel@nongnu.org; Thu, 01 Aug 2013 09:47:12 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r71Dl6WM001725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 1 Aug 2013 09:47:07 -0400 From: Gerd Hoffmann Date: Thu, 1 Aug 2013 15:11:09 +0200 Message-Id: <1375362669-14815-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1375362669-14815-1-git-send-email-kraxel@redhat.com> References: <1375362669-14815-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] usb-redir: fix use-after-free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Reinitialize dev->cs to NULL after deleting it, to make sure it isn't used afterwards. Reported-by: Martin Cerveny Signed-off-by: Gerd Hoffmann --- hw/usb/redirect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 8b8c010..e3b9f32 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1334,6 +1334,7 @@ static void usbredir_handle_destroy(USBDevice *udev) USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); qemu_chr_delete(dev->cs); + dev->cs = NULL; /* Note must be done after qemu_chr_close, as that causes a close event */ qemu_bh_delete(dev->chardev_close_bh); -- 1.7.9.7