WSL2-Linux-Kernel/drivers/usb/usbip
Niels Dossche 90ab34df66 usb: usbip: add missing device lock on tweak configuration cmd
[ Upstream commit d088fabace ]

The function documentation of usb_set_configuration says that its
callers should hold the device lock. This lock is held for all
callsites except tweak_set_configuration_cmd. The code path can be
executed for example when attaching a remote USB device.
The solution is to surround the call by the device lock.

This bug was found using my experimental own-developed static analysis
tool, which reported the missing lock on v5.17.2. I manually verified
this bug report by doing code review as well. I runtime checked that
the required lock is not held. I compiled and runtime tested this on
x86_64 with a USB mouse. After applying this patch, my analyser no
longer reports this potential bug.

Fixes: 2c8c981589 ("staging: usbip: let client choose device configuration")
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Link: https://lore.kernel.org/r/20220412165055.257113-1-dossche.niels@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:36:04 +02:00
..
Kconfig
Makefile
stub.h
stub_dev.c usb: usbip: fix a refcount leak in stub_probe() 2022-06-14 18:36:03 +02:00
stub_main.c usb: usbip: Use DEFINE_SPINLOCK() for spinlock 2021-01-07 14:34:24 +01:00
stub_rx.c usb: usbip: add missing device lock on tweak configuration cmd 2022-06-14 18:36:04 +02:00
stub_tx.c
usbip_common.c usbip: Remove in_interrupt() check 2020-10-28 13:06:06 +01:00
usbip_common.h Linux 5.12-rc8 2021-04-20 10:13:58 +02:00
usbip_event.c usbip: synchronize event handler with sysfs code paths 2021-04-05 09:05:42 +02:00
vhci.h
vhci_hcd.c usbip:vhci_hcd USB port can get stuck in the disabled state 2021-08-26 13:29:27 +02:00
vhci_rx.c kcov, usbip: collect coverage from vhci_rx_loop 2020-12-28 15:48:36 +01:00
vhci_sysfs.c usbip: add sysfs_lock to synchronize sysfs code paths 2021-04-05 09:05:42 +02:00
vhci_tx.c
vudc.h
vudc_dev.c usbip: vudc synchronize sysfs code paths 2021-04-05 09:05:42 +02:00
vudc_main.c
vudc_rx.c
vudc_sysfs.c usbip: vudc: fix missing unlock on error in usbip_sockfd_store() 2021-04-12 10:29:50 +02:00
vudc_transfer.c
vudc_tx.c