From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQUg-0000mj-AY for qemu-devel@nongnu.org; Fri, 02 Sep 2011 05:57:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzQUf-0002Bq-3C for qemu-devel@nongnu.org; Fri, 02 Sep 2011 05:57:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQUe-0002BV-Mt for qemu-devel@nongnu.org; Fri, 02 Sep 2011 05:57:00 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p829v0fL010397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Sep 2011 05:57:00 -0400 From: Gerd Hoffmann Date: Fri, 2 Sep 2011 11:56:40 +0200 Message-Id: <1314957407-29508-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1314957407-29508-1-git-send-email-kraxel@redhat.com> References: <1314957407-29508-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 11/18] 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 --- hw/usb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/usb.c b/hw/usb.c index 685e775..a091e4e 100644 --- a/hw/usb.c +++ b/hw/usb.c @@ -338,8 +338,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