Hi,

-    usb_packet_complete(&s->dev, packet);
+    s->dev.port->ops->complete(s->dev.port, packet);
  }

The hub is now directly invoking .complete() and not messing with
packet->owner (which is already NULL).  We don't hit the assertion
anymore.

Does the attached patch work for you?

cheers,
  Gerd
>From 192f6ed2d669c10d29e8f7f1f5682357fb0ce9c3 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kra...@redhat.com>
Date: Mon, 10 Oct 2011 14:12:09 +0200
Subject: [PATCH] usb: fix packet owner tracking with hub

usb_packet_complete should only clear owner when called from the device
itself, not from a usb hub.  Complements the special case for the hub in
usb_handle_packet().

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 hw/usb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/usb.c b/hw/usb.c
index 0f163b4..0c2fe86 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -347,7 +347,9 @@ void usb_packet_complete(USBDevice *dev, USBPacket *p)
 {
     /* Note: p->owner != dev is possible in case dev is a hub */
     assert(p->owner != NULL);
-    p->owner = NULL;
+    if (p->owner == dev) {
+        p->owner = NULL;
+    }
     dev->port->ops->complete(dev->port, p);
 }
 
-- 
1.7.1

Reply via email to