OpenCloudOS-Kernel/drivers/usb/core
Guenter Roeck 22547c4cc4 usb: hub: Wait for connection to be reestablished after port reset
On a system with a defective USB device connected to an USB hub,
an endless sequence of port connect events was observed. The sequence
of events as observed is as follows:

- Port reports connected event (port status=USB_PORT_STAT_CONNECTION).
- Event handler debounces port and resets it by calling hub_port_reset().
- hub_port_reset() calls hub_port_wait_reset() to wait for the reset
  to complete.
- The reset completes, but USB_PORT_STAT_CONNECTION is not immediately
  set in the port status register.
- hub_port_wait_reset() returns -ENOTCONN.
- Port initialization sequence is aborted.
- A few milliseconds later, the port again reports a connected event,
  and the sequence repeats.

This continues either forever or, randomly, stops if the connection
is already re-established when the port status is read. It results in
a high rate of udev events. This in turn destabilizes userspace since
the above sequence holds the device mutex pretty much continuously
and prevents userspace from actually reading the device status.

To prevent the problem from happening, let's wait for the connection
to be re-established after a port reset. If the device was actually
disconnected, the code will still return an error, but it will do so
only after the long reset timeout.

Cc: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-05 15:13:58 +01:00
..
Kconfig usb: core: Introduce a USB port LED trigger 2016-09-27 12:20:17 +02:00
Makefile usb: core: Introduce a USB port LED trigger 2016-09-27 12:20:17 +02:00
buffer.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
config.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
devices.c usb: core: devices: remove unnecessary & operation 2016-11-03 10:38:23 +02:00
devio.c fs: Replace CURRENT_TIME with current_time() for inode timestamps 2016-09-27 21:06:21 -04:00
driver.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
endpoint.c usb: patches for v4.10 merge window 2016-11-18 16:02:15 +01:00
file.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
generic.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
hcd-pci.c usb: hcd: out of bounds access in for_each_companion 2016-04-13 12:06:18 -07:00
hcd.c usb: core: hcd: add missing header dependencies 2016-09-27 12:20:17 +02:00
hub.c usb: hub: Wait for connection to be reestablished after port reset 2016-12-05 15:13:58 +01:00
hub.h usb: Support USB 3.1 extended port status request 2016-01-24 20:16:52 -08:00
ledtrig-usbport.c usb: core: Introduce a USB port LED trigger 2016-09-27 12:20:17 +02:00
message.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
notify.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
of.c usb: core: of.c: fix defined but not declare warning 2016-08-09 16:16:13 +02:00
otg_whitelist.h usb: core: use IS_ENABLED() instead of checking for built-in or module 2016-09-02 14:36:33 +02:00
port.c Revert "USB / PM: Allow USB devices to remain runtime-suspended when sleeping" 2016-05-02 08:44:31 -07:00
quirks.c usb: quirks: Add no-lpm quirk for Elan 2016-07-14 11:58:46 +09:00
sysfs.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
urb.c usb: patches for v4.10 merge window 2016-11-18 16:02:15 +01:00
usb-acpi.c usb: find internal hub tier mismatch via acpi 2014-05-27 16:38:52 -07:00
usb.c USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00
usb.h USB: core: add missing license information to some files 2016-10-29 12:51:56 -04:00