diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-09-07 12:47:03 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-04 21:38:12 -0400 |
commit | c37396c19403e249f12626187d51e92c915f2bc9 (patch) | |
tree | 940d7c0046678905228f7e4e1f36e6a7ca7eda8c /drivers/media/video/bt8xx/bttv-driver.c | |
parent | c737684b51e1edee16fbdf22e9a65ddad261e907 (diff) |
V4L/DVB (8955): bttv: Prevent NULL pointer dereference in radio_open
Fix the following crash in the bttv driver:
BUG: unable to handle kernel NULL pointer dereference at 000000000000036c
IP: [<ffffffffa037860a>] radio_open+0x3a/0x170 [bttv]
This happens because radio_open assumes that all present bttv devices
have a radio function. If a bttv device without radio and one with
radio are installed on the same system, and the one without radio is
registered first, then radio_open checks for the radio device number
of a bttv device that has no radio function, and this breaks. All we
have to do to fix it is to skip bttv devices without a radio function.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 6ae4cc860efe..933eaef41ead 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3431,7 +3431,7 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3431 | dprintk("bttv: open minor=%d\n",minor); | 3431 | dprintk("bttv: open minor=%d\n",minor); |
3432 | 3432 | ||
3433 | for (i = 0; i < bttv_num; i++) { | 3433 | for (i = 0; i < bttv_num; i++) { |
3434 | if (bttvs[i].radio_dev->minor == minor) { | 3434 | if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) { |
3435 | btv = &bttvs[i]; | 3435 | btv = &bttvs[i]; |
3436 | break; | 3436 | break; |
3437 | } | 3437 | } |