linux/drivers/media
Ricardo Ribalda 4dbaa738c5 media: uvcvideo: Remove dangling pointers
[ Upstream commit 221cd51efe ]

When an async control is written, we copy a pointer to the file handle
that started the operation. That pointer will be used when the device is
done. Which could be anytime in the future.

If the user closes that file descriptor, its structure will be freed,
and there will be one dangling pointer per pending async control, that
the driver will try to use.

Clean all the dangling pointers during release().

To avoid adding a performance penalty in the most common case (no async
operation), a counter has been introduced with some logic to make sure
that it is properly handled.

Cc: stable@vger.kernel.org
Fixes: e5225c820c ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-3-26c867231118@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-02-27 04:10:46 -08:00
..
cec media: pulse8-cec: fix data timestamp at pulse8_setup() 2024-11-14 13:19:34 +01:00
common media: v4l2-tpg: prevent the risk of a division by zero 2024-11-14 13:19:34 +01:00
dvb-core media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set 2024-11-22 15:38:36 +01:00
dvb-frontends media: cxd2841er: fix 64-bit division on gcc-9 2025-02-21 13:57:10 +01:00
firewire media: firewire: firedtv-avc.c: replace BUG with proper, error return 2023-08-10 07:58:37 +02:00
i2c media: i2c: ds90ub953: Add error handling for i2c reads/writes 2025-02-21 13:57:10 +01:00
mc media: mc: mark the media devnode as registered from the, start 2024-06-16 13:47:35 +02:00
mmc media: media/*/Kconfig: sort entries 2022-03-18 05:58:35 +01:00
pci media: pci: cx23885: check cx23885_vdev_init() return 2024-08-29 17:33:33 +02:00
platform media: mmp: Bring back registration of the device 2025-02-17 09:40:33 +01:00
radio media: wl128x: Fix atomicity violation in fmc_send_cmd() 2024-12-09 10:32:51 +01:00
rc media: rc: iguanair: handle timeouts 2025-02-08 09:52:23 +01:00
spi media updates for v5.18-rc1 2022-03-23 14:51:35 -07:00
test-drivers media: vidtv: Fix a null-ptr-deref in vidtv_mux_stop_thread 2025-02-21 13:57:10 +01:00
tuners Revert "media: tuners: fix error return code of hybrid_tuner_request_state()" 2024-10-04 16:29:46 +02:00
usb media: uvcvideo: Remove dangling pointers 2025-02-27 04:10:46 -08:00
v4l2-core media: mc: fix endpoint iteration 2025-02-17 09:40:33 +01:00
Kconfig media: Kconfig: Make DVB_CORE=m possible when MEDIA_SUPPORT=y 2022-12-07 17:58:46 +01:00
Makefile media: Makefiles: remove extra spaces 2022-03-12 16:59:52 +01:00