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
Makefile
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
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
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
ledtrig-usbport.c
message.c USB: CDC: fix sanity checks in CDC union parser 2019-08-15 14:49:16 +02:00
notify.c
of.c
otg_whitelist.h
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
quirks.c
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.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