From patchwork Thu Aug 1 13:11:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 264175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E68472C009D for ; Fri, 2 Aug 2013 12:54:13 +1000 (EST) Received: from localhost ([::1]:46014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V55VL-0006WJ-3D for incoming@patchwork.ozlabs.org; Thu, 01 Aug 2013 22:54:11 -0400 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 Received: from rincewind.home.kraxel.org (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r71Dl6gP020362; Thu, 1 Aug 2013 09:47:06 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id F2ECD40F10; Thu, 1 Aug 2013 15:11:09 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/2] usb-redir: fix use-after-free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);