linux/drivers/usb/core
Alan Stern c87fb861ec USB: core: Don't hold device lock while reading the "descriptors" sysfs file
commit 45bf39f8df upstream.

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-03-03 11:52:25 +01:00
..
buffer.c
config.c
devices.c
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
file.c
generic.c
hcd-pci.c USB: hcd-pci: Drop the unused id parameter from usb_hcd_pci_probe() 2022-09-01 16:08:35 +02:00
hcd.c usb: core: hcd: Fix return value check in usb_hcd_setup_local_mem() 2022-12-31 13:32:41 +01:00
hub.c USB: core: Don't hold device lock while reading the "descriptors" sysfs file 2023-03-03 11:52:25 +01:00
hub.h usb: core: hub: Create platform devices for onboard hubs in hub_probe() 2022-07-08 14:53:50 +02:00
Kconfig
ledtrig-usbport.c
Makefile usb: misc: Add onboard_usb_hub driver 2022-07-08 14:53:50 +02:00
message.c
notify.c
of.c
otg_productlist.h
phy.c
phy.h
port.c usb: hub: port: add sysfs entry to switch port power 2022-06-12 06:49:46 +02:00
quirks.c usb: core: add quirk for Alcor Link AK9563 smartcard reader 2023-02-14 19:11:52 +01:00
sysfs.c USB: core: Don't hold device lock while reading the "descriptors" sysfs file 2023-03-03 11:52:25 +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-24 07:24:34 +01:00
usb.c usb/core: fix repeated words in comments 2022-07-27 14:32:29 +02:00
usb.h