From defea0858dd3f9d9b40638e145776562fcc74c6b Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 12 May 2008 17:01:27 +0200 Subject: cx18/ivtv: fix open() kernel oops Andy Walls 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 Signed-off-by: Hans Verkuil --- linux/drivers/media/video/cx18/cx18-fileops.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'linux/drivers/media/video/cx18/cx18-fileops.c') diff --git a/linux/drivers/media/video/cx18/cx18-fileops.c b/linux/drivers/media/video/cx18/cx18-fileops.c index c1db34ff7..f9f025992 100644 --- a/linux/drivers/media/video/cx18/cx18-fileops.c +++ b/linux/drivers/media/video/cx18/cx18-fileops.c @@ -697,6 +697,8 @@ int cx18_v4l2_open(struct inode *inode, struct file *filp) for (x = 0; cx == NULL && x < cx18_cards_active; x++) { /* find out which stream this open was on */ for (y = 0; y < CX18_MAX_STREAMS; y++) { + if (cx18_cards[x] == NULL) + continue; s = &cx18_cards[x]->streams[y]; if (s->v4l2dev && s->v4l2dev->minor == minor) { cx = cx18_cards[x]; -- cgit v1.2.3