Skip to content

Commit 08c4f1b

Browse files
committed
Merge branch 'v4l_for_linus' of git://linuxtv.org/fixes
* 'v4l_for_linus' of git://linuxtv.org/fixes: V4L/DVB: dvb-core: fix initialization of feeds list in demux filter V4L/DVB: dvb_demux: Don't use vmalloc at dvb_dmx_swfilter_packet V4L/DVB: Fix the risk of an oops at dvb_dmx_release
2 parents 2b1f5c3 + 691c9ae commit 08c4f1b

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

drivers/media/dvb/dvb-core/dmxdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
761761
dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192);
762762
dmxdevfilter->type = DMXDEV_TYPE_NONE;
763763
dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED);
764-
INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
765764
init_timer(&dmxdevfilter->timer);
766765

767766
dvbdev->users++;
@@ -887,6 +886,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev,
887886
dmxdevfilter->type = DMXDEV_TYPE_PES;
888887
memcpy(&dmxdevfilter->params, params,
889888
sizeof(struct dmx_pes_filter_params));
889+
INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
890890

891891
dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET);
892892

drivers/media/dvb/dvb-core/dvb_demux.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -426,16 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
426426
};
427427
};
428428

429-
if (dvb_demux_tscheck) {
430-
if (!demux->cnt_storage)
431-
demux->cnt_storage = vmalloc(MAX_PID + 1);
432-
433-
if (!demux->cnt_storage) {
434-
printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
435-
dvb_demux_tscheck = 0;
436-
goto no_dvb_demux_tscheck;
437-
}
438-
429+
if (demux->cnt_storage) {
439430
/* check pkt counter */
440431
if (pid < MAX_PID) {
441432
if (buf[1] & 0x80)
@@ -454,7 +445,6 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
454445
};
455446
/* end check */
456447
};
457-
no_dvb_demux_tscheck:
458448

459449
list_for_each_entry(feed, &demux->feed_list, list_head) {
460450
if ((feed->pid != pid) && (feed->pid != 0x2000))
@@ -1246,6 +1236,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
12461236
dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed));
12471237
if (!dvbdemux->feed) {
12481238
vfree(dvbdemux->filter);
1239+
dvbdemux->filter = NULL;
12491240
return -ENOMEM;
12501241
}
12511242
for (i = 0; i < dvbdemux->filternum; i++) {
@@ -1257,6 +1248,13 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
12571248
dvbdemux->feed[i].index = i;
12581249
}
12591250

1251+
if (dvb_demux_tscheck) {
1252+
dvbdemux->cnt_storage = vmalloc(MAX_PID + 1);
1253+
1254+
if (!dvbdemux->cnt_storage)
1255+
printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
1256+
}
1257+
12601258
INIT_LIST_HEAD(&dvbdemux->frontend_list);
12611259

12621260
for (i = 0; i < DMX_TS_PES_OTHER; i++) {

0 commit comments

Comments
 (0)