linux/drivers/media/pci/zoran
Ruoyu Wang 0735e0b5a9 media: zoran: Avoid freeing a registered video_device twice
zoran_init_video_device() installs zoran_vdev_release() as the
video_device release callback through zoran_template. After
video_register_device() succeeds, video_unregister_device() drops the
registered video_device reference and the V4L2 core eventually invokes
that release callback, which kfree()s the video_device.

zoran_exit_video_devices() called video_unregister_device() and then
kfree(zr->video_dev), so device teardown could free the same
video_device twice.

Remove the direct kfree() and clear the cached pointer after
unregistering. The pre-registration failure path keeps its manual free
because the video_device was not registered there.

This issue was found by a static analysis checker and confirmed by
manual source review.

Fixes: 82e3a496eb ("media: staging: media: zoran: move videodev alloc")
Cc: stable@vger.kernel.org
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-07-28 15:17:54 +02:00
..
Kconfig
Makefile
videocodec.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
videocodec.h
zoran_card.c media: zoran: Avoid freeing a registered video_device twice 2026-07-28 15:17:54 +02:00
zoran_card.h media: pci: zoran: Remove unused debug parameter 2025-08-29 11:04:01 +02:00
zoran_device.c
zoran_device.h media: zoran: drop two obsolete prototypes from zoran_device.h 2023-03-20 00:22:34 +01:00
zoran_driver.c media: zoran: Rename __fh to fh 2025-08-13 08:33:47 +02:00
zoran.h media: zoran: Remove zoran_fh structure 2025-08-13 08:33:47 +02:00
zr36016.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
zr36016.h
zr36050.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
zr36050.h
zr36057.h
zr36060.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
zr36060.h