linux-uconsole/drivers/usb/core
Alan Stern e6755e71c7 USB: hub: Fix handling of connect changes during sleep
commit 9f952e2629 upstream.

Commit 8099f58f1e ("USB: hub: Don't record a connect-change event
during reset-resume") wasn't very well conceived.  The problem it
tried to fix was that if a connect-change event occurred while the
system was asleep (such as a device disconnecting itself from the bus
when it is suspended and then reconnecting when it resumes)
requiring a reset-resume during the system wakeup transition, the hub
port's change_bit entry would remain set afterward.  This would cause
the hub driver to believe another connect-change event had occurred
after the reset-resume, which was wrong and would lead the driver to
send unnecessary requests to the device (which could interfere with a
firmware update).

The commit tried to fix this by not setting the change_bit during the
wakeup.  But this was the wrong thing to do; it means that when a
device is unplugged while the system is asleep, the hub driver doesn't
realize anything has happened: The change_bit flag which would tell it
to handle the disconnect event is clear.

The commit needs to be reverted and the problem fixed in a different
way.  Fortunately an alternative solution was noted in the commit's
Changelog: We can continue to set the change_bit entry in
hub_activate() but then clear it when a reset-resume occurs.  That way
the the hub driver will see the change_bit when a device is
disconnected but won't see it when the device is still present.

That's what this patch does.

Reported-and-tested-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: 8099f58f1e ("USB: hub: Don't record a connect-change event during reset-resume")
Tested-by: Paul Zimmerman <pauldzim@gmail.com>
CC: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221602480.11262-100000@iolanthe.rowland.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-29 16:31:27 +02:00
..
buffer.c
config.c USB: core: add endpoint-blacklist quirk 2020-02-28 16:38:46 +01:00
devices.c
devio.c usb: usbfs: Suppress problematic bind and unbind uevents. 2019-12-31 16:35:16 +01:00
driver.c
endpoint.c
file.c USB: core: Fix races in character device registration and deregistraion 2019-08-25 10:47:59 +02:00
generic.c
hcd-pci.c usb: hcd: use managed device resources 2019-09-06 10:22:15 +02:00
hcd.c usb: core: Add PM runtime calls to usb_hcd_platform_shutdown 2019-05-31 06:46:30 -07:00
hub.c USB: hub: Fix handling of connect changes during sleep 2020-04-29 16:31:27 +02:00
hub.h USB: hub: Fix the broken detection of USB3 device in SMSC hub 2020-02-28 16:38:47 +01:00
Kconfig
ledtrig-usbport.c
Makefile
message.c USB: core: Fix free-while-in-use bug in the USB S-Glibrary 2020-04-29 16:31:27 +02:00
notify.c
of.c
otg_whitelist.h
phy.c
phy.h
port.c usb: core: port: do error out if usb_autopm_get_interface() fails 2020-03-11 14:14:59 +01:00
quirks.c USB: Add USB_QUIRK_DELAY_CTRL_MSG and USB_QUIRK_DELAY_INIT for Corsair K70 RGB RAPIDFIRE 2020-04-29 16:31:26 +02:00
sysfs.c
urb.c usb: core: urb: fix URB structure initialization function 2019-12-17 20:34:41 +01:00
usb-acpi.c
usb.c
usb.h USB: core: add endpoint-blacklist quirk 2020-02-28 16:38:46 +01:00