mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
media: dvb-core: fix feed leak on failed DMX_ADD_PID
dvb_dmxdev_add_pid() allocates a new dmxdev_feed, links it into filter->feed.ts and, when the filter is already running, immediately starts the feed. If starting the feed fails, the newly allocated feed remains on the list. Subsequent restart and rollback paths may then operate on this stale entry, leaving feed resources allocated and causing leaks in drivers that allocate resources from ->start_feed() and release them from ->stop_feed(). Remove the feed from the list and free it when dvb_dmxdev_start_feed() fails. Reported-by: syzbot+e9a1f5e196de6663631b@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=e9a1f5e196de6663631b Signed-off-by: Rituparna Warwatkar <rwarwatkar@gmail.com> Link: https://patch.msgid.link/20260714141059.63582-1-rwarwatkar@gmail.com Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Message-ID: <20260714141059.63582-1-rwarwatkar@gmail.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
e504cc888f
commit
9fa26c971c
@@ -884,6 +884,7 @@ static int dvb_dmxdev_add_pid(struct dmxdev *dmxdev,
|
||||
struct dmxdev_filter *filter, u16 pid)
|
||||
{
|
||||
struct dmxdev_feed *feed;
|
||||
int ret;
|
||||
|
||||
if ((filter->type != DMXDEV_TYPE_PES) ||
|
||||
(filter->state < DMXDEV_STATE_SET))
|
||||
@@ -901,8 +902,14 @@ static int dvb_dmxdev_add_pid(struct dmxdev *dmxdev,
|
||||
feed->pid = pid;
|
||||
list_add(&feed->next, &filter->feed.ts);
|
||||
|
||||
if (filter->state >= DMXDEV_STATE_GO)
|
||||
return dvb_dmxdev_start_feed(dmxdev, filter, feed);
|
||||
if (filter->state >= DMXDEV_STATE_GO) {
|
||||
ret = dvb_dmxdev_start_feed(dmxdev, filter, feed);
|
||||
if (ret < 0) {
|
||||
list_del(&feed->next);
|
||||
kfree(feed);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user