acrn-kernel/drivers
Ricardo Ribalda 4ca25c0b74 media: uvcvideo: Fix race condition with usb_kill_urb
commit 619d9b710c upstream.

usb_kill_urb warranties that all the handlers are finished when it
returns, but does not protect against threads that might be handling
asynchronously the urb.

For UVC, the function uvc_ctrl_status_event_async() takes care of
control changes asynchronously.

If the code is executed in the following order:

CPU 0					CPU 1
===== 					=====
uvc_status_complete()
					uvc_status_stop()
uvc_ctrl_status_event_work()
					uvc_status_start() -> FAIL

Then uvc_status_start will keep failing and this error will be shown:

<4>[    5.540139] URB 0000000000000000 submitted while active
drivers/usb/core/urb.c:378 usb_submit_urb+0x4c3/0x528

Let's improve the current situation, by not re-submiting the urb if
we are stopping the status event. Also process the queued work
(if any) during stop.

CPU 0					CPU 1
===== 					=====
uvc_status_complete()
					uvc_status_stop()
					uvc_status_start()
uvc_ctrl_status_event_work() -> FAIL

Hopefully, with the usb layer protection this should be enough to cover
all the cases.

Cc: stable@vger.kernel.org
Fixes: e5225c820c ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
Reviewed-by: Yunke Cao <yunkec@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-11 13:55:43 +01:00
..
accessibility
acpi PCI/ACPI: Account for _S0W of the target bridge in acpi_pci_bridge_d3() 2023-03-11 13:55:33 +01:00
amba
android
ata ata: ahci: Revert "ata: ahci: Add Tiger Lake UP{3,4} AHCI controller" 2023-03-10 09:32:32 +01:00
atm
auxdisplay auxdisplay: hd44780: Fix potential memory leak in hd44780_remove() 2023-03-11 13:55:16 +01:00
base drivers: base: dd: fix memory leak with using debugfs_lookup() 2023-03-11 13:55:39 +01:00
bcma
block loop: loop_set_status_from_info() check before assignment 2023-03-11 13:55:30 +01:00
bluetooth Bluetooth: btusb: Add VID:PID 13d3:3529 for Realtek RTL8821CE 2023-03-10 09:33:53 +01:00
bus bus: mhi: ep: Fix the debug message for MHI_PKT_TYPE_RESET_CHAN_CMD cmd 2023-03-11 13:55:35 +01:00
cdrom
char ipmi_ssif: Rename idle state and check 2023-03-10 09:34:03 +01:00
clk clk: mxl: syscon_node_to_regmap() returns error pointers 2023-02-25 11:25:39 +01:00
clocksource clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use 2023-03-10 09:33:03 +01:00
comedi
connector
counter
cpufreq cpufreq: davinci: Fix clk use after free 2023-03-10 09:33:01 +01:00
cpuidle cpuidle: add ARCH_SUSPEND_POSSIBLE dependencies 2023-03-10 09:34:22 +01:00
crypto crypto: qat - fix out-of-bounds read 2023-03-10 09:34:19 +01:00
cxl cxl/pmem: Fix nvdimm registration races 2023-03-10 09:34:20 +01:00
dax dax/kmem: Fix leak of memory-hotplug resources 2023-03-10 09:34:25 +01:00
dca
devfreq
dio
dma dmaengine: ptdma: check for null desc before calling pt_cmd_callback 2023-03-10 09:33:39 +01:00
dma-buf
edac
eisa
extcon
firewire
firmware firmware/efi sysfb_efi: Add quirk for Lenovo IdeaPad Duet 3 2023-03-11 13:55:32 +01:00
fpga fpga: microchip-spi: rewrite status polling in a time measurable way 2023-03-10 09:33:34 +01:00
fsi
gnss
gpio gpio: vf610: connect GPIO label to dev name 2023-03-10 09:33:18 +01:00
gpu drm/i915: Fix system suspend without fbdev being initialized 2023-03-11 13:55:43 +01:00
greybus
hid HID: logitech-hidpp: Don't restart communication if not necessary 2023-03-10 09:34:00 +01:00
hsi
hte
hv
hwmon hwmon: (nct6775) Fix incorrect parenthesization in nct6775_write_fan_div() 2023-03-10 09:34:23 +01:00
hwspinlock
hwtracing hwtracing: hisi_ptt: Only add the supported devices to the filters list 2023-03-10 09:33:31 +01:00
i2c i2c: designware: fix i2c_dw_clk_rate() return size to be u32 2023-03-10 09:33:29 +01:00
i3c
idle cpuidle, intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE *again* 2023-03-10 09:32:36 +01:00
iio iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_config_word() 2023-03-11 13:55:35 +01:00
infiniband RDMA/cma: Distinguish between sockaddr_in and sockaddr_in6 by size 2023-03-11 13:55:40 +01:00
input
interconnect
iommu iommu: Attach device group to old domain in error path 2023-03-11 13:55:40 +01:00
ipack
irqchip irqchip/irq-bcm7120-l2: Set IRQ_LEVEL for level triggered interrupts 2023-03-10 09:33:07 +01:00
isdn
leds leds: simatic-ipc-leds-gpio: Make sure we have the GPIO providing driver 2023-03-10 09:33:26 +01:00
macintosh
mailbox
mcb
md dm flakey: fix a bug with 32-bit highmem systems 2023-03-10 09:34:23 +01:00
media media: uvcvideo: Fix race condition with usb_kill_urb 2023-03-11 13:55:43 +01:00
memory memory: renesas-rpc-if: Move resource acquisition to .probe() 2023-03-11 13:55:17 +01:00
memstick
message
mfd mfd: arizona: Use pm_runtime_resume_and_get() to prevent refcnt leak 2023-03-11 13:55:32 +01:00
misc misc: vmw_balloon: fix memory leak with using debugfs_lookup() 2023-03-11 13:55:39 +01:00
mmc mmc: mmc_spi: fix error handling in mmc_spi_probe() 2023-02-22 12:59:48 +01:00
most
mtd ubi: ubi_wl_put_peb: Fix infinite loop when wear-leveling work failed 2023-03-11 13:55:21 +01:00
mux
net net: dsa: felix: fix internal MDIO controller resource length 2023-03-11 13:55:28 +01:00
nfc nfc: fix memory leak of se_io context in nfc_genl_se_io 2023-03-11 13:55:27 +01:00
ntb
nubus
nvdimm cxl/pmem: Fix nvdimm registration races 2023-03-10 09:34:20 +01:00
nvme nvme-fabrics: show well known discovery name 2023-03-11 13:55:31 +01:00
nvmem
of of: reserved_mem: Have kmemleak ignore dynamically allocated reserved mem 2023-02-22 12:59:46 +01:00
opp OPP: fix error checking in opp_migrate_dentry() 2023-03-10 09:33:01 +01:00
parisc
parport
pci PCI: pciehp: Add Qualcomm quirk for Command Completed erratum 2023-03-11 13:55:40 +01:00
pcmcia
peci
perf
phy phy: rockchip-typec: Fix unsigned comparison with less than zero 2023-03-11 13:55:40 +01:00
pinctrl pinctrl: at91: use devm_kasprintf() to avoid potential leaks 2023-03-10 09:33:59 +01:00
platform platform/chrome: cros_ec_typec: Update port DP VDO 2023-03-10 09:32:52 +01:00
pnp
power power: supply: remove faulty cooling logic 2023-03-10 09:33:36 +01:00
powercap powercap: fix possible name leak in powercap_register_zone() 2023-03-10 09:32:56 +01:00
pps
ps3
ptp ptp: vclock: use mutex to fix "sleep on atomic" bug 2023-03-11 13:55:25 +01:00
pwm pwm: stm32-lp: fix the check on arr and cmp registers update 2023-03-11 13:55:17 +01:00
rapidio
ras
regulator regulator: core: Use ktime_get_boottime() to determine how long a regulator was off 2023-03-10 09:34:25 +01:00
remoteproc remoteproc/mtk_scp: Move clk ops outside send_lock 2023-03-10 09:34:26 +01:00
reset
rpmsg rpmsg: glink: Release driver_override 2023-03-10 09:33:45 +01:00
rtc rtc: allow rtc_read_alarm without read_alarm callback 2023-03-11 13:55:30 +01:00
s390 s390: vfio-ap: tighten the NIB validity check 2023-03-10 09:33:02 +01:00
sbus
scsi scsi: mpi3mr: Use number of bits to manage bitmap sizes 2023-03-11 13:55:29 +01:00
sh
siox
slimbus
soc soc: qcom: stats: Populate all subsystem debugfs files 2023-03-11 13:55:22 +01:00
soundwire soundwire: cadence: Drain the RX FIFO after an IO timeout 2023-03-11 13:55:40 +01:00
spi spi: tegra210-quad: Fix iterator outside loop 2023-03-11 13:55:29 +01:00
spmi
ssb
staging staging: pi433: fix memory leak with using debugfs_lookup() 2023-03-11 13:55:36 +01:00
target
tc
tee
thermal thermal: intel: BXT_PMIC: select REGMAP instead of depending on it 2023-03-11 13:55:32 +01:00
thunderbolt
tty tty: pcn_uart: fix memory leak with using debugfs_lookup() 2023-03-11 13:55:39 +01:00
ufs scsi: ufs: core: Fix device management cmd timeout flow 2023-03-10 09:34:00 +01:00
uio
usb usb: gadget: uvc: Make bSourceID read/write 2023-03-11 13:55:38 +01:00
vdpa vDPA/ifcvf: allocate the adapter in dev_add() 2023-03-11 13:55:42 +01:00
vfio vfio/type1: restore locked_vm 2023-03-10 09:34:32 +01:00
vhost
video Revert "fbcon: don't lose the console font across generic->chip driver switch" 2023-03-10 09:33:56 +01:00
virt virt/sev-guest: Return -EIO if certificate buffer is not large enough 2023-03-10 09:34:14 +01:00
virtio
vlynq
w1
watchdog watchdog: sbsa_wdog: Make sure the timeout programming is within the limits 2023-03-11 13:55:24 +01:00
xen xen/grant-dma-iommu: Implement a dummy probe_device() callback 2023-03-10 09:33:02 +01:00
zorro
Kconfig
Makefile