usb-bus: Don't allow speed mismatch while attaching devices
authorHans de Goede <hdegoede@redhat.com>
Fri, 27 May 2011 12:50:39 +0000 (14:50 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 23 Jun 2011 09:28:07 +0000 (11:28 +0200)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb-bus.c

index fc72018..2abce12 100644 (file)
@@ -200,6 +200,11 @@ static int do_attach(USBDevice *dev)
     } else {
         port = QTAILQ_FIRST(&bus->free);
     }
+    if (!(port->speedmask & dev->speedmask)) {
+        error_report("Warning: speed mismatch trying to attach usb device %s to bus %s\n",
+                dev->product_desc, bus->qbus.name);
+        return -1;
+    }
 
     dev->attached++;
     QTAILQ_REMOVE(&bus->free, port, next);