diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-08 14:07:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-08 14:07:10 -0500 |
commit | 08c4f1b096cc2468908ea58a77d2ef92ef765c52 (patch) | |
tree | e4295e94c2000d03bf934095f7b0fa5b8b39a79f | |
parent | 2b1f5c3ac3ebcf9d1cb3f87b4fd929201324e2bb (diff) | |
parent | 691c9ae099b9bcb5c27125af00a4a90120977458 (diff) |
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
-rw-r--r-- | drivers/media/dvb/dvb-core/dmxdev.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_demux.c | 20 |
2 files changed, 10 insertions, 12 deletions
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index c37790ad92d0..9ddc57909d49 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -761,7 +761,6 @@ static int dvb_demux_open(struct inode *inode, struct file *file) | |||
761 | dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192); | 761 | dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192); |
762 | dmxdevfilter->type = DMXDEV_TYPE_NONE; | 762 | dmxdevfilter->type = DMXDEV_TYPE_NONE; |
763 | dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); | 763 | dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); |
764 | INIT_LIST_HEAD(&dmxdevfilter->feed.ts); | ||
765 | init_timer(&dmxdevfilter->timer); | 764 | init_timer(&dmxdevfilter->timer); |
766 | 765 | ||
767 | dvbdev->users++; | 766 | dvbdev->users++; |
@@ -887,6 +886,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev, | |||
887 | dmxdevfilter->type = DMXDEV_TYPE_PES; | 886 | dmxdevfilter->type = DMXDEV_TYPE_PES; |
888 | memcpy(&dmxdevfilter->params, params, | 887 | memcpy(&dmxdevfilter->params, params, |
889 | sizeof(struct dmx_pes_filter_params)); | 888 | sizeof(struct dmx_pes_filter_params)); |
889 | INIT_LIST_HEAD(&dmxdevfilter->feed.ts); | ||
890 | 890 | ||
891 | dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); | 891 | dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); |
892 | 892 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index b78cfb7d1897..67f189b7aa1f 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
@@ -426,16 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
426 | }; | 426 | }; |
427 | }; | 427 | }; |
428 | 428 | ||
429 | if (dvb_demux_tscheck) { | 429 | if (demux->cnt_storage) { |
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 | |||
439 | /* check pkt counter */ | 430 | /* check pkt counter */ |
440 | if (pid < MAX_PID) { | 431 | if (pid < MAX_PID) { |
441 | if (buf[1] & 0x80) | 432 | if (buf[1] & 0x80) |
@@ -454,7 +445,6 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
454 | }; | 445 | }; |
455 | /* end check */ | 446 | /* end check */ |
456 | }; | 447 | }; |
457 | no_dvb_demux_tscheck: | ||
458 | 448 | ||
459 | list_for_each_entry(feed, &demux->feed_list, list_head) { | 449 | list_for_each_entry(feed, &demux->feed_list, list_head) { |
460 | if ((feed->pid != pid) && (feed->pid != 0x2000)) | 450 | if ((feed->pid != pid) && (feed->pid != 0x2000)) |
@@ -1246,6 +1236,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) | |||
1246 | dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed)); | 1236 | dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed)); |
1247 | if (!dvbdemux->feed) { | 1237 | if (!dvbdemux->feed) { |
1248 | vfree(dvbdemux->filter); | 1238 | vfree(dvbdemux->filter); |
1239 | dvbdemux->filter = NULL; | ||
1249 | return -ENOMEM; | 1240 | return -ENOMEM; |
1250 | } | 1241 | } |
1251 | for (i = 0; i < dvbdemux->filternum; i++) { | 1242 | for (i = 0; i < dvbdemux->filternum; i++) { |
@@ -1257,6 +1248,13 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) | |||
1257 | dvbdemux->feed[i].index = i; | 1248 | dvbdemux->feed[i].index = i; |
1258 | } | 1249 | } |
1259 | 1250 | ||
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 | |||
1260 | INIT_LIST_HEAD(&dvbdemux->frontend_list); | 1258 | INIT_LIST_HEAD(&dvbdemux->frontend_list); |
1261 | 1259 | ||
1262 | for (i = 0; i < DMX_TS_PES_OTHER; i++) { | 1260 | for (i = 0; i < DMX_TS_PES_OTHER; i++) { |