linux/drivers/usb/core
Keiya Nobuta d5b0c0eafe usb: core: hub: Improved device recognition on remote wakeup
commit 9c06ac4c83 upstream.

If hub_activate() is called before D+ has stabilized after remote
wakeup, the following situation might occur:

         __      ___________________
        /  \    /
D+   __/    \__/

Hub  _______________________________
          |  ^   ^           ^
          |  |   |           |
Host _____v__|___|___________|______
          |  |   |           |
          |  |   |           \-- Interrupt Transfer (*3)
          |  |    \-- ClearPortFeature (*2)
          |   \-- GetPortStatus (*1)
          \-- Host detects remote wakeup

- D+ goes high, Host starts running by remote wakeup
- D+ is not stable, goes low
- Host requests GetPortStatus at (*1) and gets the following hub status:
  - Current Connect Status bit is 0
  - Connect Status Change bit is 1
- D+ stabilizes, goes high
- Host requests ClearPortFeature and thus Connect Status Change bit is
  cleared at (*2)
- After waiting 100 ms, Host starts the Interrupt Transfer at (*3)
- Since the Connect Status Change bit is 0, Hub returns NAK.

In this case, port_event() is not called in hub_event() and Host cannot
recognize device. To solve this issue, flag change_bits even if only
Connect Status Change bit is 1 when got in the first GetPortStatus.

This issue occurs rarely because it only if D+ changes during a very
short time between GetPortStatus and ClearPortFeature. However, it is
fatal if it occurs in embedded system.

Signed-off-by: Keiya Nobuta <nobuta.keiya@fujitsu.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20200109051448.28150-1-nobuta.keiya@fujitsu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:36 +01:00
..
Kconfig usb: remove redundant 'default n' from Kconfig-s 2019-05-21 10:06:22 +02:00
Makefile usb: core: add a wrapper for the USB PHYs on the HCD 2018-03-09 09:43:53 -08:00
buffer.c usb: add a hcd_uses_dma helper 2019-08-15 15:18:05 +02:00
config.c USB: Fix: Don't skip endpoint descriptors with maxpacket=0 2020-01-14 20:08:38 +01:00
devices.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
devio.c usb: usbfs: Suppress problematic bind and unbind uevents. 2019-12-31 16:44:07 +01:00
driver.c USB: add support for dev_groups to struct usb_device_driver 2019-08-07 14:05:04 +02:00
endpoint.c USB: core: move existing SPDX tags to top of the file 2017-11-03 10:12:26 +01:00
file.c USB: core: Fix races in character device registration and deregistraion 2019-08-12 22:47:24 +02:00
generic.c usbfs: Add ioctls for runtime power management 2019-08-09 07:55:45 +02:00
hcd-pci.c Merge 5.3-rc7 into usb-next 2019-09-02 19:31:18 +02:00
hcd.c USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-21 11:04:21 +01:00
hub.c usb: core: hub: Improved device recognition on remote wakeup 2020-01-23 08:22:36 +01:00
hub.h usb: hub: add retry routine after intr URB submit error 2019-01-18 09:58:04 +01:00
ledtrig-usbport.c USB: leds: fix regression in usbport led trigger 2019-01-18 09:55:05 +01:00
message.c USB: CDC: fix sanity checks in CDC union parser 2019-08-15 14:49:16 +02:00
notify.c USB: core: Remove usbfs_mutex 2019-06-26 10:28:09 +08:00
of.c usb: Change usb_of_get_companion_dev() place to usb/common 2018-09-10 20:40:29 +02:00
otg_whitelist.h USB: core: Remove redundant license text 2017-11-04 11:55:39 +01:00
phy.c usb: core: phy: add support for PHY calibration 2019-09-03 15:54:55 +02:00
phy.h usb: core: phy: add support for PHY calibration 2019-09-03 15:54:55 +02:00
port.c USB: Disable USB2 LPM at shutdown 2019-08-05 17:19:46 +02:00
quirks.c USB: Fix chipmunk-like voice when using Logitech C270 for recording audio. 2019-06-05 11:52:42 +02:00
sysfs.c usb: setup authorized_default attributes using usb_bus_notify 2019-08-08 16:07:34 +02:00
urb.c usb: core: urb: fix URB structure initialization function 2019-12-17 19:55:48 +01:00
usb-acpi.c usb: assign ACPI companions for embedded USB devices 2019-01-25 08:46:26 +01:00
usb.c usb: remove commented out dma wrappers 2019-09-03 15:26:12 +02:00
usb.h Merge 5.3-rc4 into usb-next 2019-08-12 07:42:51 +02:00