linux/drivers/usb/core
Alan Stern 9f952e2629 USB: hub: Fix handling of connect changes during sleep
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-23 15:22:41 +02:00
..
buffer.c usb: add a hcd_uses_dma helper 2019-08-15 15:18:05 +02:00
config.c USB: core: clean up endpoint-descriptor parsing 2020-02-10 11:14:22 -08:00
devices.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
devio.c USB: usbfs: Always unlink URBs in reverse order 2020-01-17 17:57:04 +01:00
driver.c USB: Fallback to generic driver when specific driver fails 2020-02-12 11:01:55 -08: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 USB: Fallback to generic driver when specific driver fails 2020-02-12 11:01:55 -08:00
hcd-pci.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
hcd.c USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-11 09:06:41 +01:00
hub.c USB: hub: Fix handling of connect changes during sleep 2020-04-23 15:22:41 +02:00
hub.h USB: hub: Fix the broken detection of USB3 device in SMSC hub 2020-02-10 11:08:26 -08:00
Kconfig usb: remove redundant 'default n' from Kconfig-s 2019-05-21 10:06:22 +02:00
ledtrig-usbport.c USB: leds: fix regression in usbport led trigger 2019-01-18 09:55:05 +01:00
Makefile usb: core: add a wrapper for the USB PHYs on the HCD 2018-03-09 09:43:53 -08:00
message.c USB: core: Fix free-while-in-use bug in the USB S-Glibrary 2020-04-16 14:46:00 +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: core: port: do error out if usb_autopm_get_interface() fails 2020-03-04 10:58:16 +01:00
quirks.c USB: Add USB_QUIRK_DELAY_CTRL_MSG and USB_QUIRK_DELAY_INIT for Corsair K70 RGB RAPIDFIRE 2020-04-16 15:27:52 +02:00
sysfs.c usb: use kobj_to_dev() API 2020-02-14 08:38:15 -08:00
urb.c usb: core: urb: fix URB structure initialization function 2019-12-10 11:41:19 +01:00
usb-acpi.c usb: core: Use ACPI_SUCCESS() at appropriate places 2020-02-19 11:08:52 +01:00
usb.c usb: remove commented out dma wrappers 2019-09-03 15:26:12 +02:00
usb.h Merge 5.6-rc3 into usb-next 2020-02-24 08:48:49 +01:00