Skip to content

Commit 1ac7c8a

Browse files
Shuah Khangregkh
authored andcommitted
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>
1 parent 770b2ed commit 1ac7c8a

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎tools/usb/usbip/libsrc/vhci_driver.c‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,17 @@ int usbip_vhci_refresh_device_list(void)
329329
int usbip_vhci_get_free_port(uint32_t speed)
330330
{
331331
for (int i = 0; i < vhci_driver->nports; i++) {
332-
if (speed == USB_SPEED_SUPER &&
333-
vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
334-
continue;
332+
333+
switch (speed) {
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+
}
335343

336344
if (vhci_driver->idev[i].status == VDEV_ST_NULL)
337345
return vhci_driver->idev[i].port;

0 commit comments

Comments
 (0)