usb-hub: don't trigger assert on packet completion.
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 13 Oct 2011 10:52:47 +0000 (12:52 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 13 Oct 2011 11:16:34 +0000 (13:16 +0200)
Calling usb_packet_complete() recursively when passing up the completion
event up the chain for devices connected via usb hub will trigger an
assert.  So don't do that, make the usb hub emulation call the upstream
completion callback directly instead.

Based on a patch from Stefan Hajnoczi <stefanha@gmail.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb-hub.c

index 39382c738630614b3894c8a867870b2242db5388..09c65160c2d9c27d7353dac259293ed9e8ebe066 100644 (file)
@@ -207,10 +207,14 @@ static void usb_hub_complete(USBPort *port, USBPacket *packet)
     /*
      * Just pass it along upstream for now.
      *
-     * If we ever inplement usb 2.0 split transactions this will
+     * If we ever implement usb 2.0 split transactions this will
      * become a little more complicated ...
+     *
+     * Can't use usb_packet_complete() here because packet->owner is
+     * cleared already, go call the ->complete() callback directly
+     * instead.
      */
-    usb_packet_complete(&s->dev, packet);
+    s->dev.port->ops->complete(s->dev.port, packet);
 }
 
 static void usb_hub_handle_reset(USBDevice *dev)