diff options
author | Andy Walls <awalls@radix.net> | 2008-05-12 14:01:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-05-14 01:56:45 -0400 |
commit | 07c87a833e9ef92280ed24ab85cd4eb49cbca9c0 (patch) | |
tree | 58ba6654998600742c352f12ed5ed1967e1f598e /drivers/media/video | |
parent | cba627a51a26eaed3526c423f5fd0410dd721ae2 (diff) |
V4L/DVB (7891): cx18/ivtv: fix open() kernel oops
Upon error conditions in cx18/ivtv_probe(), the code at the 'err:' label
leaves a NULL entry in cx18/ivtv_cards[]. This can cause a NULL pointer
de-reference in cx18/ivtv_v4l2_open() which is fixed by this patch.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx18/cx18-fileops.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fileops.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c index 91eff6e671a7..0b3141db174b 100644 --- a/drivers/media/video/cx18/cx18-fileops.c +++ b/drivers/media/video/cx18/cx18-fileops.c | |||
@@ -662,6 +662,8 @@ int cx18_v4l2_open(struct inode *inode, struct file *filp) | |||
662 | for (x = 0; cx == NULL && x < cx18_cards_active; x++) { | 662 | for (x = 0; cx == NULL && x < cx18_cards_active; x++) { |
663 | /* find out which stream this open was on */ | 663 | /* find out which stream this open was on */ |
664 | for (y = 0; y < CX18_MAX_STREAMS; y++) { | 664 | for (y = 0; y < CX18_MAX_STREAMS; y++) { |
665 | if (cx18_cards[x] == NULL) | ||
666 | continue; | ||
665 | s = &cx18_cards[x]->streams[y]; | 667 | s = &cx18_cards[x]->streams[y]; |
666 | if (s->v4l2dev && s->v4l2dev->minor == minor) { | 668 | if (s->v4l2dev && s->v4l2dev->minor == minor) { |
667 | cx = cx18_cards[x]; | 669 | cx = cx18_cards[x]; |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 2b74b0ab1477..f2fa434b677b 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -987,6 +987,8 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) | |||
987 | /* Find which card this open was on */ | 987 | /* Find which card this open was on */ |
988 | spin_lock(&ivtv_cards_lock); | 988 | spin_lock(&ivtv_cards_lock); |
989 | for (x = 0; itv == NULL && x < ivtv_cards_active; x++) { | 989 | for (x = 0; itv == NULL && x < ivtv_cards_active; x++) { |
990 | if (ivtv_cards[x] == NULL) | ||
991 | continue; | ||
990 | /* find out which stream this open was on */ | 992 | /* find out which stream this open was on */ |
991 | for (y = 0; y < IVTV_MAX_STREAMS; y++) { | 993 | for (y = 0; y < IVTV_MAX_STREAMS; y++) { |
992 | s = &ivtv_cards[x]->streams[y]; | 994 | s = &ivtv_cards[x]->streams[y]; |