diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2017-11-29 17:24:22 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-30 11:40:02 -0500 |
commit | 1ac7c8a78be85f84b019d3d2742d1a9f07255cc5 (patch) | |
tree | b629c4efccfa31f5b38d914273587b2d1e2938c7 /tools/usb/usbip/libsrc | |
parent | 770b2edece42fa55bbe7d4cbe53347a07b8968d4 (diff) |
usbip: fix usbip attach to find a port that matches the requested speed
usbip attach fails to find a free port when the device on the first port
is a USB_SPEED_SUPER device and non-super speed device is being attached.
It keeps checking the first port and returns without a match getting stuck
in a loop.
Fix it check to find the first port with matching speed.
Reported-by: Juan Zea <juan.zea@qindel.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/usb/usbip/libsrc')
-rw-r--r-- | tools/usb/usbip/libsrc/vhci_driver.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index 5727dfb15a83..8a1cd1616de4 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c | |||
@@ -329,9 +329,17 @@ err: | |||
329 | int usbip_vhci_get_free_port(uint32_t speed) | 329 | int usbip_vhci_get_free_port(uint32_t speed) |
330 | { | 330 | { |
331 | for (int i = 0; i < vhci_driver->nports; i++) { | 331 | for (int i = 0; i < vhci_driver->nports; i++) { |
332 | if (speed == USB_SPEED_SUPER && | 332 | |
333 | vhci_driver->idev[i].hub != HUB_SPEED_SUPER) | 333 | switch (speed) { |
334 | continue; | 334 | case USB_SPEED_SUPER: |
335 | if (vhci_driver->idev[i].hub != HUB_SPEED_SUPER) | ||
336 | continue; | ||
337 | break; | ||
338 | default: | ||
339 | if (vhci_driver->idev[i].hub != HUB_SPEED_HIGH) | ||
340 | continue; | ||
341 | break; | ||
342 | } | ||
335 | 343 | ||
336 | if (vhci_driver->idev[i].status == VDEV_ST_NULL) | 344 | if (vhci_driver->idev[i].status == VDEV_ST_NULL) |
337 | return vhci_driver->idev[i].port; | 345 | return vhci_driver->idev[i].port; |