Commit 08c4f1b0 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 2b1f5c3a 691c9ae0
...@@ -761,7 +761,6 @@ static int dvb_demux_open(struct inode *inode, struct file *file) ...@@ -761,7 +761,6 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192); dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192);
dmxdevfilter->type = DMXDEV_TYPE_NONE; dmxdevfilter->type = DMXDEV_TYPE_NONE;
dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED);
INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
init_timer(&dmxdevfilter->timer); init_timer(&dmxdevfilter->timer);
dvbdev->users++; dvbdev->users++;
...@@ -887,6 +886,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev, ...@@ -887,6 +886,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev,
dmxdevfilter->type = DMXDEV_TYPE_PES; dmxdevfilter->type = DMXDEV_TYPE_PES;
memcpy(&dmxdevfilter->params, params, memcpy(&dmxdevfilter->params, params,
sizeof(struct dmx_pes_filter_params)); sizeof(struct dmx_pes_filter_params));
INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET);
......
...@@ -426,16 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) ...@@ -426,16 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
}; };
}; };
if (dvb_demux_tscheck) { if (demux->cnt_storage) {
if (!demux->cnt_storage)
demux->cnt_storage = vmalloc(MAX_PID + 1);
if (!demux->cnt_storage) {
printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
dvb_demux_tscheck = 0;
goto no_dvb_demux_tscheck;
}
/* check pkt counter */ /* check pkt counter */
if (pid < MAX_PID) { if (pid < MAX_PID) {
if (buf[1] & 0x80) if (buf[1] & 0x80)
...@@ -454,7 +445,6 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) ...@@ -454,7 +445,6 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
}; };
/* end check */ /* end check */
}; };
no_dvb_demux_tscheck:
list_for_each_entry(feed, &demux->feed_list, list_head) { list_for_each_entry(feed, &demux->feed_list, list_head) {
if ((feed->pid != pid) && (feed->pid != 0x2000)) if ((feed->pid != pid) && (feed->pid != 0x2000))
...@@ -1246,6 +1236,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) ...@@ -1246,6 +1236,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++) {
...@@ -1257,6 +1248,13 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) ...@@ -1257,6 +1248,13 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
dvbdemux->feed[i].index = i; dvbdemux->feed[i].index = i;
} }
if (dvb_demux_tscheck) {
dvbdemux->cnt_storage = vmalloc(MAX_PID + 1);
if (!dvbdemux->cnt_storage)
printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
}
INIT_LIST_HEAD(&dvbdemux->frontend_list); INIT_LIST_HEAD(&dvbdemux->frontend_list);
for (i = 0; i < DMX_TS_PES_OTHER; i++) { for (i = 0; i < DMX_TS_PES_OTHER; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment