linux/drivers/media/usb/dvb-usb
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
..
a800.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
af9005-fe.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
af9005-remote.c
af9005-script.h
af9005.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
af9005.h
az6027.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
az6027.h
cinergyT2-core.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
cinergyT2-fe.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
cinergyT2.h
cxusb-analog.c
cxusb.c media: cxusb: no longer judge rbuf when the write fails 2025-04-25 15:14:31 +02:00
cxusb.h
dib07x0.h
dib0700_core.c
dib0700_devices.c
dib0700.h
dibusb-common.c
dibusb-mb.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
dibusb-mc-common.c
dibusb-mc.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
dibusb.h
digitv.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
digitv.h
dtt200u-fe.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dtt200u.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
dtt200u.h
dtv5100.c media: dvb-usb: dtv5100: fix out-of-bounds in dtv5100_i2c_msg() 2025-10-14 15:07:36 +02:00
dtv5100.h
dvb-usb-common.h
dvb-usb-dvb.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dvb-usb-firmware.c
dvb-usb-i2c.c
dvb-usb-init.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dvb-usb-remote.c media: rc: fix race between unregister and urb/irq callbacks 2026-03-17 14:43:56 +01:00
dvb-usb-urb.c
dvb-usb.h media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
dw2102.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
dw2102.h
gp8psk.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
gp8psk.h
Kconfig
m920x.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
m920x.h
Makefile
nova-t-usb2.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
opera1.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
pctv452e.c media: dvb-usb: pctv452e: move snd/rcv len check before kmalloc 2025-11-04 13:31:02 +01:00
technisat-usb2.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
ttusb2.c media: dvb-usb: Constify struct i2c_algorithm 2025-02-21 10:33:12 +01:00
ttusb2.h
umt-010.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
usb-urb.c
vp702x-fe.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
vp702x.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
vp702x.h
vp7045-fe.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
vp7045.c media: dvb-usb: Constify struct usb_device_id 2025-02-21 10:33:08 +01:00
vp7045.h