android_kernel_motorola_sm6375/drivers/usb
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Alan Stern 12d6a5681a USB: core: Fix deadlock in usb_deauthorize_interface()
commit 80ba43e9f799cbdd83842fc27db667289b3150f5 upstream.

Among the attribute file callback routines in
drivers/usb/core/sysfs.c, the interface_authorized_store() function is
the only one which acquires a device lock on an ancestor device: It
calls usb_deauthorize_interface(), which locks the interface's parent
USB device.

The will lead to deadlock if another process already owns that lock
and tries to remove the interface, whether through a configuration
change or because the device has been disconnected.  As part of the
removal procedure, device_del() waits for all ongoing sysfs attribute
callbacks to complete.  But usb_deauthorize_interface() can't complete
until the device lock has been released, and the lock won't be
released until the removal has finished.

The mechanism provided by sysfs to prevent this kind of deadlock is
to use the sysfs_break_active_protection() function, which tells sysfs
not to wait for the attribute callback.

Reported-and-tested by: Yue Sun <samsun1006219@gmail.com>
Reported by: xingwei lee <xrivendell7@gmail.com>

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/linux-usb/CAEkJfYO6jRVC8Tfrd_R=cjO0hguhrV31fDPrLrNOOHocDkPoAA@mail.gmail.com/#r
Fixes: 310d2b4124 ("usb: interface authorization: SysFS part of USB interface authorization")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1c37eea1-9f56-4534-b9d8-b443438dc869@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-13 12:51:32 +02:00
..
atm
c67x00
cdns3 usb: cdns3: fix memory double free when handle zero packet 2024-03-01 13:13:36 +01:00
chipidea usb: chipidea: wait controller resume finished for wakeup irq 2024-01-25 14:34:29 -08:00
class usb: cdc-wdm: close race between read and workqueue 2024-04-13 12:51:31 +02:00
common
core USB: core: Fix deadlock in usb_deauthorize_interface() 2024-04-13 12:51:32 +02:00
dwc2 usb: dwc2: gadget: LPM flow fix 2024-04-13 12:51:32 +02:00
dwc3 Revert "usb: dwc3: don't reset device side if dwc3 was configured as host-only" 2024-01-25 14:34:29 -08:00
early
gadget usb: udc: remove warning when queue disabled ep 2024-04-13 12:51:32 +02:00
host usb: fotg210-hcd: delete an incorrect bounds test 2024-01-08 11:29:47 +01:00
image
isp1760
misc
mon usb: mon: Fix atomicity violation in mon_bin_vma_fault 2024-01-25 14:34:30 -08:00
mtu3
musb
phy usb: phy: mxs: remove CONFIG_USB_OTG condition for mxs_phy_is_otg_host() 2024-01-25 14:34:29 -08:00
renesas_usbhs
roles usb: roles: don't get/set_role() when usb_role_switch is unregistered 2024-03-01 13:13:36 +01:00
serial USB: serial: cp210x: add pid/vid for TDK NC0110013M and MM0110113M 2024-04-13 12:51:25 +02:00
storage USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command 2024-04-13 12:51:29 +02:00
typec usb: typec: class: fix typec_altmode_put_partner to put plugs 2024-01-25 14:34:30 -08:00
usbip
Kconfig
Makefile
usb-skeleton.c