kernel_optimize_test/drivers/usb/usbip
Niels Dossche e100742823 usb: usbip: add missing device lock on tweak configuration cmd
[ Upstream commit d088fabace2ca337b275d1d4b36db4fe7771e44f ]

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:32:31 +02:00
..
Kconfig
Makefile
stub_dev.c
stub_main.c
stub_rx.c
stub_tx.c
stub.h
usbip_common.c
usbip_common.h
usbip_event.c
vhci_hcd.c
vhci_rx.c
vhci_sysfs.c
vhci_tx.c
vhci.h
vudc_dev.c
vudc_main.c
vudc_rx.c
vudc_sysfs.c
vudc_transfer.c
vudc_tx.c
vudc.h