linux/drivers/media/usb
Ricardo Ribalda ac18d78146 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-03-07 16:56:33 +01:00
..
airspy media: airspy: fix memory leak in airspy probe 2022-08-30 07:31:42 +02:00
as102 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 118 2019-05-24 17:39:02 +02:00
au0828 media: mc: convert pipeline funcs to take media_pad 2022-09-24 09:22:30 +02:00
b2c2 media: flexcop-usb: fix sanity check of bNumEndpoints 2024-06-12 11:03:47 +02:00
cx231xx media: cx231xx: Add support for Dexatek USB Video Grabber 1d19:6108 2024-12-14 19:54:38 +01:00
dvb-usb media: Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()" 2024-08-19 06:00:07 +02:00
dvb-usb-v2 media: lmedm04: Handle errors for lme2510_int_read 2025-02-21 13:49:17 +01:00
em28xx media: em28xx: annotate unchecked call to media_device_register() 2024-03-26 18:20:46 -04:00
go7007 media: go7007: fix a memleak in go7007_load_encoder 2024-03-26 18:20:51 -04:00
gspca media: gspca: ov534-ov772x: Fix off-by-one error in set_frame_rate() 2024-12-14 19:54:12 +01:00
hackrf media: Kconfig: cleanup VIDEO_DEV dependencies 2022-03-18 05:58:35 +01:00
hdpvr media: hdpvr: fix error value returns in hdpvr_read 2022-06-27 09:02:50 +01:00
msi2500 media: usb/msi2500: fix repeated words in comments 2022-09-24 08:46:38 +02:00
pvrusb2 media: pvrusb2: fix uaf in pvr2_context_set_notify 2024-03-26 18:20:51 -04:00
pwc media: Kconfig: cleanup VIDEO_DEV dependencies 2022-03-18 05:58:35 +01:00
s2255 media: s2255: Use refcount_t instead of atomic_t for num_channels 2024-07-11 12:47:08 +02:00
siano drivers: usb: smsusb: fix error handling code in smsusb_init_device 2023-09-13 09:42:50 +02:00
stk1160 media: stk1160: fix bounds checking in stk1160_copy_video() 2024-06-12 11:03:47 +02:00
ttusb-budget media: dvb-ttusb-budget: cleanup printk logic 2020-09-03 11:15:47 +02:00
ttusb-dec media: ttusb-dec: fix memory leak in ttusb_dec_exit_dvb() 2023-06-09 10:34:12 +02:00
usbtv media: usbtv: Remove useless locks in usbtv_video_free() 2024-10-17 15:21:33 +02:00
uvc media: uvcvideo: Remove dangling pointers 2025-03-07 16:56:33 +01:00
Kconfig media: tm6000: deprecate this driver 2022-08-29 16:43:00 +02:00
Makefile media: tm6000: deprecate this driver 2022-08-29 16:43:00 +02:00