[PATCH] media: dvb-core: stop the feeds that did start when a PES filter fails to start

From: Yudi Kurniawan

Date: Sat Dec 05 2026 - 03:36:02 EST


Hi,

this is a fix for the syzbot report "memory leak in
vidtv_psi_service_desc_init (2)":

https://syzkaller.appspot.com/bug?extid=acc3b75c010446ad403f

The bug is not in vidtv. The reproducer opens a PES filter with
DMX_IMMEDIATE_START, adds a PID with DMX_ADD_PID and then calls DMX_START.

On DMX_START, dvb_dmxdev_filter_start() first calls dvb_dmxdev_filter_stop(),
which pushes the filter state back to DMXDEV_STATE_SET, and then restarts every
feed of the filter one by one. The second feed, the one added by DMX_ADD_PID,
fails in dmx_ts_feed_set() with -EINVAL, because dvb_demux allows only a single
feed per pes_type and both feeds use the same one.

The error path then calls dvb_dmxdev_filter_stop() to undo the work, but that
function returns immediately for any state below DMXDEV_STATE_GO, and the state
is DMXDEV_STATE_SET at that point. The feed that did start is left running and
the driver is never asked to stop it, so the mux allocated by
vidtv_start_feed() leaks.

I reproduced it in QEMU with the syzbot C reproducer on a 7.1 kernel, 2 vCPU,
kmemleak enabled. Before the patch kmemleak reports five leaked objects with the
vidtv_psi_service_desc_init <- vidtv_channel_s302m_init <- vidtv_mux_init <-
vidtv_start_feed backtrace. After the patch the same reproducer runs clean for
14 consecutive iterations.

The patch also clears feed->ts whenever dvb_dmxdev_start_feed() releases a feed
it failed to set up, so a later stop or release cannot follow a dangling
pointer, and the stop and release loops skip feeds that have no ts_feed.

Thanks,
Yudi Kurniawan