linux/drivers/usb/core
Alan Stern 45bf39f8df USB: core: Don't hold device lock while reading the "descriptors" sysfs file
Ever since commit 83e83ecb79 ("usb: core: get config and string
descriptors for unauthorized devices") was merged in 2013, there has
been no mechanism for reallocating the rawdescriptors buffers in
struct usb_device after the initial enumeration.  Before that commit,
the buffers would be deallocated when a device was deauthorized and
reallocated when it was authorized and enumerated.

This means that the locking in the read_descriptors() routine is not
needed, since the buffers it reads will never be reallocated while the
routine is running.  This locking can interfere with user programs
trying to read a hub's descriptors via sysfs while new child devices
of the hub are being initialized, since the hub is locked during this
procedure.

Since the locking in read_descriptors() hasn't been needed for over
nine years, we can remove it.

Reported-and-tested-by: Troels Liebe Bentsen <troels@connectedcars.dk>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: stable@vger.kernel.org
Link: https://lore.kernel.org/r/Y9l+wDTRbuZABzsE@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-31 21:54:35 +01:00
..
buffer.c usb: core: Replace in_interrupt() in comments 2020-10-28 12:32:59 +01:00
config.c USB: core: Change configuration warnings to notices 2022-11-03 23:46:00 +09:00
devices.c usb: core: devices: drop redundant buffer overflow checks 2022-04-26 13:57:38 +02:00
devio.c usb: move from strlcpy with unused retval to strscpy 2022-08-19 11:08:54 +02:00
driver.c usb/core: fix repeated words in comments 2022-07-27 14:32:29 +02:00
endpoint.c usb: common: add function to get interval expressed in us unit 2021-03-10 09:37:17 +01:00
file.c driver core: make struct class.devnode() take a const * 2022-11-24 17:12:27 +01:00
generic.c usb: core: Fix file path that does not exist 2021-12-05 14:24:19 +01:00
hcd-pci.c xhci: disable U3 suspended ports in S4 hibernate poweroff_late stage 2022-11-30 12:10:48 +01:00
hcd.c usb: core: hcd: Fix return value check in usb_hcd_setup_local_mem() 2022-11-29 08:56:09 +01:00
hub.c USB: core: Don't hold device lock while reading the "descriptors" sysfs file 2023-01-31 21:54:35 +01:00
hub.h usb: core: stop USB enumeration if too many retries 2022-11-08 16:50:21 +01:00
Kconfig USB: hub: Add Kconfig option to reduce number of port initialization retries 2020-10-02 11:29:02 +02:00
ledtrig-usbport.c
Makefile usb: misc: Add onboard_usb_hub driver 2022-07-08 14:53:50 +02:00
message.c USB: core: export usb_cache_string() 2022-12-12 11:39:12 +01:00
notify.c
of.c
otg_productlist.h
phy.c
phy.h
port.c usb: core: stop USB enumeration if too many retries 2022-11-08 16:50:21 +01:00
quirks.c usb: add NO_LPM quirk for Realforce 87U Keyboard 2022-11-09 14:07:47 +01:00
sysfs.c USB: core: Don't hold device lock while reading the "descriptors" sysfs file 2023-01-31 21:54:35 +01:00
urb.c kmsan: handle memory sent to/from USB 2022-10-03 14:03:22 -07:00
usb-acpi.c usb: acpi: add helper to check port lpm capability using acpi _DSM 2023-01-17 16:37:24 +01:00
usb.c USB: fix memory leak with using debugfs_lookup() 2023-01-17 17:23:31 +01:00
usb.h USB: core: export usb_cache_string() 2022-12-12 11:39:12 +01:00