Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usbip:vhci_hcd USB port can get stuck in the disabled state

When a remote usb device is attached to the local Virtual USB
Host Controller Root Hub port, the bound device driver may send
a port reset command.

vhci_hcd accepts port resets only when the device doesn't have
port address assigned to it. When reset happens device is in
assigned/used state and vhci_hcd rejects it leaving the port in
a stuck state.

This problem was found when a blue-tooth or xbox wireless dongle
was passed through using usbip.

A few drivers reset the port during probe including mt76 driver
specific to this bug report. Fix the problem with a change to
honor reset requests when device is in used state (VDEV_ST_USED).

Reported-and-tested-by: Michael <msbroadf@gmail.com>
Suggested-by: Michael <msbroadf@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210819225937.41037-1-skhan@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Shuah Khan and committed by
Greg Kroah-Hartman
66cce9e7 5289253b

+7 -1
+7 -1
drivers/usb/usbip/vhci_hcd.c
··· 455 455 vhci_hcd->port_status[rhport] &= ~(1 << USB_PORT_FEAT_RESET); 456 456 vhci_hcd->re_timeout = 0; 457 457 458 + /* 459 + * A few drivers do usb reset during probe when 460 + * the device could be in VDEV_ST_USED state 461 + */ 458 462 if (vhci_hcd->vdev[rhport].ud.status == 459 - VDEV_ST_NOTASSIGNED) { 463 + VDEV_ST_NOTASSIGNED || 464 + vhci_hcd->vdev[rhport].ud.status == 465 + VDEV_ST_USED) { 460 466 usbip_dbg_vhci_rh( 461 467 " enable rhport %d (status %u)\n", 462 468 rhport,