From 4d8debba766265d70cb7bf11570e3622512641d6 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 25 Aug 2011 16:43:15 +0200 Subject: usb: fix use after free 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 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/usb.c') diff --git a/hw/usb.c b/hw/usb.c index 685e775a00..a091e4eafc 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 -- cgit v1.2.3