From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQYw-0005h2-Ej for qemu-devel@nongnu.org; Fri, 02 Sep 2011 06:01:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzQYu-0003Yr-CZ for qemu-devel@nongnu.org; Fri, 02 Sep 2011 06:01:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQYt-0003YL-Qi for qemu-devel@nongnu.org; Fri, 02 Sep 2011 06:01:24 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p82A1NLv000439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Sep 2011 06:01:23 -0400 From: Gerd Hoffmann Date: Fri, 2 Sep 2011 12:01:13 +0200 Message-Id: <1314957674-30133-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1314957674-30133-1-git-send-email-kraxel@redhat.com> References: <1314957674-30133-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 6/7] usb: fix use after free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann The ->complete() callback might have released the USBPacket (uhci actually does), so we must not touch it after the callback returns. Signed-off-by: Gerd Hoffmann (cherry picked from commit 722d89396b6ccb49cd9d3aafd991ae01c8a30744) --- hw/usb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/usb.c b/hw/usb.c index 27a983c..b44e997 100644 --- a/hw/usb.c +++ b/hw/usb.c @@ -334,8 +334,8 @@ void usb_packet_complete(USBDevice *dev, USBPacket *p) { /* Note: p->owner != dev is possible in case dev is a hub */ assert(p->owner != NULL); - dev->port->ops->complete(dev->port, p); p->owner = NULL; + dev->port->ops->complete(dev->port, p); } /* Cancel an active packet. The packed must have been deferred by -- 1.7.1