linux-stable/drivers
Alan Stern ab062fa3dc USB: core: Fix deadlock in usb_deauthorize_interface()
commit 80ba43e9f7 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-03 15:19:55 +02:00
..
accessibility speakup: Fix 8bit characters from direct synth 2024-04-03 15:19:33 +02:00
acpi ACPI: scan: Fix device check notification handling 2024-03-26 18:20:38 -04:00
amba
android binder: signal epoll threads of self-work 2024-02-23 09:12:39 +01:00
ata scsi: sd: Fix TCG OPAL unlock on system resume 2024-04-03 15:19:51 +02:00
atm atm: idt77252: fix a memleak in open_card_ubr0 2024-02-16 19:06:26 +01:00
auxdisplay auxdisplay: hd44780: move cursor home after clear display command 2023-12-08 08:51:16 +01:00
base PM: sleep: wakeirq: fix wake irq warning in system suspend 2024-04-03 15:19:30 +02:00
bcma
block aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:20:29 -04:00
bluetooth Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() 2024-03-26 18:20:40 -04:00
bus bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-03-26 18:20:36 -04:00
cdrom
char hwrng: core - Fix page fault dead lock on mmap-ed hwrng 2024-01-31 16:16:58 -08:00
clk clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays 2024-04-03 15:19:29 +02:00
clocksource clocksource/drivers/arm_global_timer: Fix maximum prescaler value 2024-04-03 15:19:44 +02:00
comedi comedi: comedi_test: Prevent timers rescheduling during deletion 2024-03-26 18:20:57 -04:00
connector
counter
cpufreq cpufreq: brcmstb-avs-cpufreq: fix up "add check for cpufreq_cpu_get's return value" 2024-04-03 15:19:39 +02:00
cpuidle
crypto crypto: qat - resolve race condition during AER recovery 2024-04-03 15:19:26 +02:00
cxl cxl/pci: Fix disabling memory if DVSEC CXL Range does not match a CFMWS window 2024-03-01 13:26:31 +01:00
dax
dca
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2024-02-05 20:12:47 +00:00
dio
dma dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA 2024-03-26 18:20:45 -04:00
dma-buf dma-buf: fix check in dma_resv_add_fence 2023-12-08 08:51:15 +01:00
edac EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 15:27:18 -08:00
eisa
extcon
firewire firewire: core: use long bus reset on gap count error 2024-03-26 18:20:27 -04:00
firmware efi/libstub: Cast away type warning in use of max() 2024-04-03 15:19:48 +02:00
fpga
fsi
gnss
gpio gpio: vf610: allow disabling the vf610 driver 2024-03-26 18:20:33 -04:00
gpu drm/i915/gt: Reset queue_priority_hint on parking 2024-04-03 15:19:50 +02:00
greybus
hid HID: amd_sfh: Avoid disabling the interrupt 2024-03-26 18:20:51 -04:00
hsi
hte hte: tegra: Fix missing error code in tegra_hte_test_probe() 2023-11-20 11:51:58 +01:00
hv
hwmon hwmon: (amc6821) add of_match table 2024-04-03 15:19:32 +02:00
hwspinlock
hwtracing hwtracing: hisi_ptt: Move type check to the beginning of hisi_ptt_pmu_event_init() 2024-03-26 18:20:58 -04:00
i2c i2c: i801: Avoid potential double call to gpiod_remove_lookup_table 2024-04-03 15:19:43 +02:00
i3c i3c: master: cdns: Update maximum prescaler value for i2c clock 2024-02-05 20:12:58 +00:00
idle
iio iio: accel: adxl367: fix I2C FIFO data register 2024-04-03 15:19:43 +02:00
infiniband RDMA/rtrs-clt: Check strnlen return len in sysfs mpath_policy_store() 2024-03-26 18:20:55 -04:00
input Input: gpio_keys_polled - suppress deferred probe error for gpio 2024-03-26 18:20:27 -04:00
interconnect Revert "interconnect: Teach lockdep about icc_bw_lock order" 2024-03-06 14:45:19 +00:00
iommu iommu/dma: Force swiotlb_max_mapping_size on an untrusted device 2024-04-03 15:19:44 +02:00
ipack
irqchip irqchip/renesas-rzg2l: Prevent spurious interrupts when setting trigger type 2024-04-03 15:19:45 +02:00
isdn
leds leds: sgm3140: Add missing timer cleanup and flash gpio control 2024-03-26 18:20:52 -04:00
macintosh
mailbox mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt 2024-02-05 20:12:58 +00:00
mcb mcb: fix error handling for different scenarios when parsing 2023-11-28 17:07:13 +00:00
md dm snapshot: fix lockup in dm_exception_table_exit 2024-04-03 15:19:39 +02:00
media media: mc: Expand MUST_CONNECT flag to always require an enabled link 2024-04-03 15:19:25 +02:00
memory
memstick
message
mfd mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref 2024-03-26 18:20:50 -04:00
misc mei: me: add arrow lake point H DID 2024-04-03 15:19:42 +02:00
mmc mmc: core: Avoid negative index with array access 2024-04-03 15:19:49 +02:00
most
mtd mtd: rawnand: meson: fix scrambling mode value in command macro 2024-04-03 15:19:27 +02:00
mux
net net: ll_temac: platform_get_resource replaced by wrong function 2024-04-03 15:19:49 +02:00
nfc
ntb NTB: fix possible name leak in ntb_register_device() 2024-03-26 18:20:49 -04:00
nubus
nvdimm nd_btt: Make BTT lanes preemptible 2023-11-20 11:52:05 +01:00
nvme nvme: fix reconnection fail due to reserved tag allocation 2024-03-26 18:20:59 -04:00
nvmem nvmem: meson-efuse: fix function pointer type mismatch 2024-04-03 15:19:32 +02:00
of of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing 2024-03-06 14:45:09 +00:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:20:42 -04:00
parisc parisc/power: Fix power soft-off button emulation on qemu 2024-01-31 16:16:59 -08:00
parport parport: parport_serial: Add Brainboxes device IDs and geometry 2024-01-20 11:50:11 +01:00
pci PCI: hv: Fix ring buffer size calculation 2024-04-03 15:19:34 +02:00
pcmcia pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:52:13 +01:00
peci
perf perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count) 2024-03-26 18:20:24 -04:00
phy phy: tegra: xusb: Add API to retrieve the port number of phy 2024-04-03 15:19:33 +02:00
pinctrl gpio: nomadik: fix offset bug in nmk_pmx_set() 2024-03-26 18:20:52 -04:00
platform platform/x86: p2sb: On Goldmont only cache P2SB and SPI devfn BAR 2024-04-03 15:19:39 +02:00
pnp PNP: ACPI: fix fortify warning 2024-02-05 20:12:47 +00:00
power power: supply: bq27xxx-i2c: Do not free non existing IRQ 2024-03-06 14:45:09 +00:00
powercap powercap: dtpm_cpu: Fix error check against freq_qos_add_request() 2024-03-26 18:20:36 -04:00
pps
ps3
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 17:07:05 +00:00
pwm pwm: img: fix pwm clock lookup 2024-04-03 15:19:45 +02:00
rapidio
ras
regulator regulator: pwm-regulator: Add validity checks in continuous .get_voltage 2024-03-01 13:26:26 +01:00
remoteproc remoteproc: virtio: Fix wdg cannot recovery remote processor 2024-04-03 15:19:24 +02:00
reset reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning 2024-01-20 11:50:07 +01:00
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-01-31 16:16:59 -08:00
rtc rtc: mt6397: select IRQ_DOMAIN instead of depending on it 2024-03-26 18:20:58 -04:00
s390 s390/zcrypt: fix reference counting on zcrypt card objects 2024-04-03 15:19:36 +02:00
sbus
scsi scsi: libsas: Fix disk not being scanned in after being removed 2024-04-03 15:19:54 +02:00
sh
siox
slimbus slimbus: core: Remove usage of the deprecated ida_simple_xx() API 2024-04-03 15:19:33 +02:00
soc soc: fsl: qbman: Use raw spinlock for cgr_lock 2024-04-03 15:19:36 +02:00
soundwire soundwire: stream: fix NULL pointer dereference for multi_link 2023-12-20 17:00:25 +01:00
spi spi: spi-mt65xx: Fix NULL pointer access in interrupt handler 2024-03-26 18:21:02 -04:00
spmi spmi: mediatek: Fix UAF on device remove 2024-02-05 20:12:58 +00:00
ssb
staging staging: vc04_services: fix information leak in create_component() 2024-04-03 15:19:51 +02:00
target scsi: target: pscsi: Fix bio_put() for error case 2024-03-01 13:26:31 +01:00
tc
tee tee: optee: Fix kernel panic caused by incorrect error handling 2024-04-03 15:19:42 +02:00
thermal thermal: devfreq_cooling: Fix perf state when calculate dfc res_util 2024-04-03 15:19:49 +02:00
thunderbolt thunderbolt: Fix memory leak in margining_port_remove() 2024-01-01 12:39:08 +00:00
tty tty: serial: imx: Fix broken RS485 2024-04-03 15:19:46 +02:00
ufs scsi: ufs: core: Remove the ufshcd_release() in ufshcd_err_handling_prepare() 2024-03-01 13:26:30 +01:00
uio uio: Fix use-after-free in uio_open 2024-01-20 11:50:10 +01:00
usb USB: core: Fix deadlock in usb_deauthorize_interface() 2024-04-03 15:19:55 +02:00
vdpa vdpa/mlx5: Allow CVQ size changes 2024-03-26 18:21:00 -04:00
vfio vfio/fsl-mc: Block calling interrupt handler without trigger 2024-04-03 15:19:47 +02:00
vhost vhost: use kzalloc() instead of kmalloc() followed by memset() 2024-02-16 19:06:31 +01:00
video backlight: lp8788: Fully initialize backlight_properties during probe 2024-03-26 18:20:53 -04:00
virt virt: sevguest: Fix passing a stack buffer as a scatterlist target 2023-11-20 11:52:13 +01:00
virtio
vlynq
w1
watchdog watchdog: stm32_iwdg: initialize default timeout 2024-03-26 18:20:56 -04:00
xen xen/events: close evtchn after mapping cleanup 2024-03-06 14:45:20 +00:00
zorro
Kconfig
Makefile