diff options
| author | Alan Stern <[email protected]> | 2023-01-31 20:49:04 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2023-01-31 20:54:35 +0000 |
| commit | 45bf39f8df7f05efb83b302c65ae3b9bc92b7065 (patch) | |
| tree | 18ae9c594efe73bf020c4b80ddca0dacea382426 /drivers/usb/core/hub.c | |
| parent | usb: early: xhci-dbc: Use memcpy_and_pad() (diff) | |
| download | kernel-45bf39f8df7f05efb83b302c65ae3b9bc92b7065.tar.gz kernel-45bf39f8df7f05efb83b302c65ae3b9bc92b7065.zip | |
USB: core: Don't hold device lock while reading the "descriptors" sysfs file
Ever since commit 83e83ecb79a8 ("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 <[email protected]>
Signed-off-by: Alan Stern <[email protected]>
CC: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/core/hub.c')
| -rw-r--r-- | drivers/usb/core/hub.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9eca403af2a8..97a0f8faea6e 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2389,9 +2389,8 @@ static int usb_enumerate_device_otg(struct usb_device *udev) * usb_enumerate_device - Read device configs/intfs/otg (usbcore-internal) * @udev: newly addressed device (in ADDRESS state) * - * This is only called by usb_new_device() and usb_authorize_device() - * and FIXME -- all comments that apply to them apply here wrt to - * environment. + * This is only called by usb_new_device() -- all comments that apply there + * apply here wrt to environment. * * If the device is WUSB and not authorized, we don't attempt to read * the string descriptors, as they will be errored out by the device |
