linux-stable/drivers/usb
Alan Stern f4d1960764 USB: core: Fix deadlock in port "disable" sysfs attribute
The show and store callback routines for the "disable" sysfs attribute
file in port.c acquire the device lock for the port's parent hub
device.  This can cause problems if another process has locked the hub
to remove it or change its configuration:

	Removing the hub or changing its configuration requires the
	hub interface to be removed, which requires the port device
	to be removed, and device_del() waits until all outstanding
	sysfs attribute callbacks for the ports have returned.  The
	lock can't be released until then.

	But the disable_show() or disable_store() routine can't return
	until after it has acquired the lock.

The resulting deadlock can be avoided by calling
sysfs_break_active_protection().  This will cause the sysfs core not
to wait for the attribute's callback routine to return, allowing the
removal to proceed.  The disadvantage is that after making this call,
there is no guarantee that the hub structure won't be deallocated at
any moment.  To prevent this, we have to acquire a reference to it
first by calling hub_get().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/f7a8c135-a495-4ce6-bd49-405a45e7ea9a@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-26 15:02:28 +01:00
..
atm
c67x00
cdns3
chipidea
class usb: cdc-wdm: close race between read and workqueue 2024-03-26 14:56:33 +01:00
common
core USB: core: Fix deadlock in port "disable" sysfs attribute 2024-03-26 15:02:28 +01:00
dwc2 usb: dwc2: gadget: LPM flow fix 2024-03-26 14:56:28 +01:00
dwc3 usb: dwc3: pci: Drop duplicate ID 2024-03-26 14:58:24 +01:00
early
fotg210
gadget usb: udc: remove warning when queue disabled ep 2024-03-26 14:58:36 +01:00
host
image
isp1760
misc
mon
mtu3
musb
phy Revert "usb: phy: generic: Get the vbus supply" 2024-03-26 14:57:22 +01:00
renesas_usbhs
roles
serial
storage
typec usb: typec: ucsi: Check capabilities before cable and identity discovery 2024-03-26 15:01:15 +01:00
usbip
Kconfig
Makefile
usb-skeleton.c