linux/drivers/media/usb/dvb-usb-v2
Sean Young dccc0c3ddf media: rc: fix race between unregister and urb/irq callbacks
Some rc device drivers have a race condition between rc_unregister_device()
and irq or urb callbacks. This is because rc_unregister_device() does two
things, it marks the device as unregistered so no new commands can be
issued and then it calls rc_free_device(). This means the driver has no
chance to cancel any pending urb callbacks or interrupts after the device
has been marked as unregistered. Those callbacks may access struct rc_dev
or its members (e.g. struct ir_raw_event_ctrl), which have been freed by
rc_free_device().

This change removes the implicit call to rc_free_device() from
rc_unregister_device(). This means that device drivers can call
rc_unregister_device() in their remove or disconnect function, then cancel
all the urbs and interrupts before explicitly calling rc_free_device().

Note this is an alternative fix for an issue found by Haotian Zhang, see
the Closes: tags.

Reported-by: Haotian Zhang <vulab@iscas.ac.cn>
Closes: https://lore.kernel.org/linux-media/20251114101432.2566-1-vulab@iscas.ac.cn/
Closes: https://lore.kernel.org/linux-media/20251114101418.2548-1-vulab@iscas.ac.cn/
Closes: https://lore.kernel.org/linux-media/20251114101346.2530-1-vulab@iscas.ac.cn/
Closes: https://lore.kernel.org/linux-media/20251114090605.2413-1-vulab@iscas.ac.cn/
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-03-17 14:43:56 +01:00
..
af9015.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
af9015.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
af9035.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
af9035.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
anysee.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
anysee.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
au6610.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
au6610.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
az6007.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
ce6230.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
ce6230.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
dvb_usb_common.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
dvb_usb_core.c media: rc: fix race between unregister and urb/irq callbacks 2026-03-17 14:43:56 +01:00
dvb_usb_urb.c Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
dvb_usb.h media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
dvbsky.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
ec168.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
ec168.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
gl861.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
Kconfig media: media/*/Kconfig: sort entries 2022-03-18 05:58:35 +01:00
lmedm04.c media: dvb-usb-v2: lmedm04: Fix firmware macro definitions 2025-11-05 14:08:55 +01:00
lmedm04.h media: docs: move driver-specific info to driver-api 2020-04-14 10:36:18 +02:00
Makefile media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
mxl111sf-demod.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mxl111sf-demod.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-gpio.c media: Use fallthrough pseudo-keyword 2020-08-29 08:35:27 +02:00
mxl111sf-gpio.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-i2c.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-phy.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-phy.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf-tuner.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mxl111sf-tuner.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxl111sf.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
mxl111sf.h media: docs: move driver-specific info to driver-api 2020-04-14 10:36:18 +02:00
rtl28xxu.c media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
rtl28xxu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
usb_urb.c media: dvb-usb-v2: Fix incorrect use of transfer_flags URB_FREE_BUFFER 2018-12-03 13:23:24 -05:00
zd1301.c media: usb: dvb-usb-v2: zd1301: fix missing platform_device_unregister() 2020-11-17 06:57:29 +01:00