Skip to contentSkip to conversation

usb bugfixes for 2.2

GIT PULL Applied Gerd Hoffmann 2 participants 5 messages Nov 12, 2014 – Nov 13, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

usb patch queue with three little fixes.

please pull,
Gerd

The following changes since commit 558c2c8ddfb165a36eb95dc93125c04829d68aa7:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2014-11-10 16:28:51 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-usb-20141112-1

for you to fetch changes up to 79ae25af1569a50a0ec799901a1bb280c088f121:

usb-host: fix usb_host_speed_compat tyops (2014-11-12 15:27:23 +0100)

----------------------------------------------------------------
usb bugfixes for 2.2

----------------------------------------------------------------
Chris Johns (1):
Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined.

Gerd Hoffmann (2):
xhci: add sanity checks to xhci_lookup_uport
usb-host: fix usb_host_speed_compat tyops

 hw/usb/hcd-xhci.c    |  9 +++++++++
 hw/usb/host-libusb.c | 12 +++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
#1 lore raw

[Qemu-devel] [PULL for-2.2 3/3] usb-host: fix usb_host_speed_compat tyops

---
 hw/usb/host-libusb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/usb/host-libusb.c +3 -3
index 032a0e4..a5f9dab 100644
@@ -749,13 +749,13 @@ static void usb_host_speed_compat(USBHostDevice *s)
 
     udev->speedmask = (1 << udev->speed);
     if (udev->speed == USB_SPEED_SUPER && compat_high) {
-        udev->speedmask |= USB_SPEED_HIGH;
+        udev->speedmask |= USB_SPEED_MASK_HIGH;
     }
     if (udev->speed == USB_SPEED_SUPER && compat_full) {
-        udev->speedmask |= USB_SPEED_FULL;
+        udev->speedmask |= USB_SPEED_MASK_FULL;
     }
     if (udev->speed == USB_SPEED_HIGH && compat_full) {
-        udev->speedmask |= USB_SPEED_FULL;
+        udev->speedmask |= USB_SPEED_MASK_FULL;
     }
 }
 
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL for-2.2 1/3] Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined.

In reply to Gerd Hoffmann

From: Chris Johns <[email protected]>

---
 hw/usb/host-libusb.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/usb/host-libusb.c +6 -0
index d2d161b..032a0e4 100644
@@ -143,6 +143,12 @@ static void usb_host_attach_kernel(USBHostDevice *s);
 
 /* ------------------------------------------------------------------------ */
 
+#ifndef LIBUSB_LOG_LEVEL_WARNING /* older libusb didn't define these */
+#define LIBUSB_LOG_LEVEL_WARNING 2
+#endif
+
+/* ------------------------------------------------------------------------ */
+
 #define CONTROL_TIMEOUT  10000        /* 10 sec    */
 #define BULK_TIMEOUT         0        /* unlimited */
 #define INTR_TIMEOUT         0        /* unlimited */
Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL for-2.2 2/3] xhci: add sanity checks to xhci_lookup_uport

In reply to Gerd Hoffmann

Also catch xhci_lookup_uport failures in post_load.

https://bugzilla.redhat.com/show_bug.cgi?id=1074219

---
 hw/usb/hcd-xhci.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/usb/hcd-xhci.c +9 -0
index 2930b72..9a942cf 100644
@@ -2262,6 +2262,9 @@ static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx)
     int i, pos, port;
 
     port = (slot_ctx[1]>>16) & 0xFF;
+    if (port < 1 || port > xhci->numports) {
+        return NULL;
+    }
     port = xhci->ports[port-1].uport->index+1;
     pos = snprintf(path, sizeof(path), "%d", port);
     for (i = 0; i < 5; i++) {
@@ -3706,6 +3709,12 @@ static int usb_xhci_post_load(void *opaque, int version_id)
             xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid));
         xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx));
         slot->uport = xhci_lookup_uport(xhci, slot_ctx);
+        if (!slot->uport) {
+            /* should not happen, but may trigger on guest bugs */
+            slot->enabled = 0;
+            slot->addressed = 0;
+            continue;
+        }
         assert(slot->uport && slot->uport->dev);
 
         for (epid = 1; epid <= 31; epid++) {
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Gerd Hoffmann
Quoted 16 lines · Gerd Hoffmann

Hi,

usb patch queue with three little fixes.

please pull,
Gerd

The following changes since commit 558c2c8ddfb165a36eb95dc93125c04829d68aa7:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2014-11-10 16:28:51 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-usb-20141112-1

Quoted 8 lines

for you to fetch changes up to 79ae25af1569a50a0ec799901a1bb280c088f121:

usb-host: fix usb_host_speed_compat tyops (2014-11-12 15:27:23 +0100)

----------------------------------------------------------------
usb bugfixes for 2.2

----------------------------------------------------------------

Applied, thanks.

-- PMM