V4L/DVB (8955): bttv: Prevent NULL pointer dereference in radio_open
authorJean Delvare <[email protected]>
Sun, 7 Sep 2008 16:47:03 +0000 (13:47 -0300)
committerMauro Carvalho Chehab <[email protected]>
Sun, 5 Oct 2008 01:38:12 +0000 (22:38 -0300)
commitc37396c19403e249f12626187d51e92c915f2bc9
tree940d7c0046678905228f7e4e1f36e6a7ca7eda8c
parentc737684b51e1edee16fbdf22e9a65ddad261e907
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 <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
drivers/media/video/bt8xx/bttv-driver.c