Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adefdcee authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

V4L/DVB: Fix the risk of an oops at dvb_dmx_release



dvb_dmx_init tries to allocate virtual memory for 2 pointers: filter and feed.

If the second vmalloc fails, filter is freed, but the pointer keeps pointing
to the old place. Later, when dvb_dmx_release() is called, it will try to
free an already freed memory, causing an OOPS.

Reviewed-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6339204e
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -1246,6 +1246,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
	dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed));
	dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed));
	if (!dvbdemux->feed) {
	if (!dvbdemux->feed) {
		vfree(dvbdemux->filter);
		vfree(dvbdemux->filter);
		dvbdemux->filter = NULL;
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	for (i = 0; i < dvbdemux->filternum; i++) {
	for (i = 0; i < dvbdemux->filternum; i++) {