[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171129222422.19037-1-shuahkh@osg.samsung.com>
Date: Wed, 29 Nov 2017 15:24:22 -0700
From: Shuah Khan <shuahkh@....samsung.com>
To: shuah@...nel.org, valentina.manea.m@...il.com
Cc: Shuah Khan <shuahkh@....samsung.com>, gregkh@...uxfoundation.org,
yuyang.du@...el.com, k.opasiak@...sung.com,
kstewart@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, juan.zea@...del.com
Subject: [PATCH] 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@...del.com>
Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
tools/usb/usbip/libsrc/vhci_driver.c | 14 +++++++++++---
1 file 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 @@ int usbip_vhci_refresh_device_list(void)
int usbip_vhci_get_free_port(uint32_t speed)
{
for (int i = 0; i < vhci_driver->nports; i++) {
- if (speed == USB_SPEED_SUPER &&
- vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
- continue;
+
+ switch (speed) {
+ case USB_SPEED_SUPER:
+ if (vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
+ continue;
+ break;
+ default:
+ if (vhci_driver->idev[i].hub != HUB_SPEED_HIGH)
+ continue;
+ break;
+ }
if (vhci_driver->idev[i].status == VDEV_ST_NULL)
return vhci_driver->idev[i].port;
--
2.14.1
Powered by blists - more mailing lists