linux/drivers/media/test-drivers
Jeongjun Park a69c7fd603 media: vidtv: initialize local pointers upon transfer of memory ownership
commit 98aabfe2d7 upstream.

vidtv_channel_si_init() creates a temporary list (program, service, event)
and ownership of the memory itself is transferred to the PAT/SDT/EIT
tables through vidtv_psi_pat_program_assign(),
vidtv_psi_sdt_service_assign(), vidtv_psi_eit_event_assign().

The problem here is that the local pointer where the memory ownership
transfer was completed is not initialized to NULL. This causes the
vidtv_psi_pmt_create_sec_for_each_pat_entry() function to fail, and
in the flow that jumps to free_eit, the memory that was freed by
vidtv_psi_*_table_destroy() can be accessed again by
vidtv_psi_*_event_destroy() due to the uninitialized local pointer, so it
is freed once again.

Therefore, to prevent use-after-free and double-free vulnerability,
local pointers must be initialized to NULL when transferring memory
ownership.

Cc: <stable@vger.kernel.org>
Reported-by: syzbot+1d9c0edea5907af239e0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1d9c0edea5907af239e0
Fixes: 3be8037960 ("media: vidtv: add error checks")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-01-08 10:14:21 +01:00
..
vicodec media: vicodec: allow en/decoder cmd w/o CAPTURE 2024-08-25 08:15:24 +02:00
vidtv media: vidtv: initialize local pointers upon transfer of memory ownership 2026-01-08 10:14:21 +01:00
vimc media: vimc: skip .s_stream() for stopped entities 2025-04-10 14:39:40 +02:00
visl media: visl: Fix ERANGE error when setting enum controls 2025-04-20 10:15:35 +02:00
vivid media: vivid: fix disappearing <Vendor Command With ID> messages 2025-10-19 16:33:47 +02:00
Kconfig media: drop CONFIG_MEDIA_CONTROLLER_REQUEST_API 2023-11-23 13:03:45 +01:00
Makefile media: visl: add virtual stateless decoder driver 2022-11-25 07:32:16 +00:00
vim2m.c media: vim2m: print device name after registering device 2025-04-20 10:15:33 +02:00