linux/drivers/media
Ruslan Valiyev 5c986b7720 media: vidtv: fix NULL pointer dereference in vidtv_channel_pmt_match_sections
commit f8e1fc918a upstream.

syzbot reported a general protection fault in vidtv_psi_desc_assign [1].

vidtv_psi_pmt_stream_init() can return NULL on memory allocation
failure, but vidtv_channel_pmt_match_sections() does not check for
this. When tail is NULL, the subsequent call to
vidtv_psi_desc_assign(&tail->descriptor, desc) dereferences a NULL
pointer offset, causing a general protection fault.

Add a NULL check after vidtv_psi_pmt_stream_init(). On failure, clean
up the already-allocated stream chain and return.

[1]
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:vidtv_psi_desc_assign+0x24/0x90 drivers/media/test-drivers/vidtv/vidtv_psi.c:629
Call Trace:
 <TASK>
 vidtv_channel_pmt_match_sections drivers/media/test-drivers/vidtv/vidtv_channel.c:349 [inline]
 vidtv_channel_si_init+0x1445/0x1a50 drivers/media/test-drivers/vidtv/vidtv_channel.c:479
 vidtv_mux_init+0x526/0xbe0 drivers/media/test-drivers/vidtv/vidtv_mux.c:519
 vidtv_start_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:194 [inline]
 vidtv_start_feed+0x33e/0x4d0 drivers/media/test-drivers/vidtv/vidtv_bridge.c:239

Fixes: f90cf6079b ("media: vidtv: add a bridge driver")
Cc: stable@vger.kernel.org
Reported-by: syzbot+1f5bcc7c919ec578777a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1f5bcc7c919ec578777a
Signed-off-by: Ruslan Valiyev <linuxoid@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-06-01 17:35:05 +02:00
..
cec media: cec: Fix debugfs leak on bus_register() failure 2026-01-19 13:10:02 +01:00
common media: videobuf2: use sgtable-based scatterlist wrappers 2025-06-27 11:05:24 +01:00
dvb-core media: dvb-net: fix OOB access in ULE extension header tables 2026-04-18 10:33:15 +02:00
dvb-frontends minmax: make generic MIN() and MAX() macros available everywhere 2025-10-19 16:21:52 +02:00
firewire media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt() 2021-11-06 14:13:30 +01:00
i2c media: i2c: ov5647: use our own mutex for the ctrl lock 2026-03-04 07:20:28 -05:00
mc media: mc, v4l2: serialize REINIT and REQBUFS with req_queue_mutex 2026-04-18 10:33:27 +02:00
mmc media updates for v5.8-rc1 2020-06-03 20:59:38 -07:00
pci media: cx25821: Add missing unmap in snd_cx25821_hw_params() 2026-03-04 07:20:27 -05:00
platform media: venus: vdec: fix error state assignment for zero bytesused 2026-03-04 07:20:30 -05:00
radio media: radio-keene: fix memory leak in error path 2026-03-04 07:20:26 -05:00
rc media: rc: st_rc: Fix reset control resource leak 2026-01-19 13:10:01 +01:00
spi media: cxd2880-spi: Fix a null pointer dereference on error handling path 2021-11-18 19:16:27 +01:00
test-drivers media: vidtv: fix NULL pointer dereference in vidtv_channel_pmt_match_sections 2026-06-01 17:35:05 +02:00
tuners media: fix uninitialized symbol warnings 2025-12-07 06:09:20 +09:00
usb media: uvcvideo: Use heuristic to find stream entity 2026-04-18 10:33:35 +02:00
v4l2-core media: mc, v4l2: serialize REINIT and REQBUFS with req_queue_mutex 2026-04-18 10:33:27 +02:00
Kconfig media: correct MEDIA_TEST_SUPPORT help text 2022-01-27 11:05:20 +01:00
Makefile media: media/test_drivers: rename to test-drivers 2020-04-16 10:38:31 +02:00