Skip to content

Commit

Permalink
[media] videodev: fix a NULL pointer dereference in v4l2_device_relea…
Browse files Browse the repository at this point in the history
…se()

The change in 8280b66 does not cover the case when v4l2_dev is already
NULL, fix that.

With a Kinect sensor, seen as an USB camera using GSPCA in this context,
a NULL pointer dereference BUG can be triggered by just unplugging the
device after the camera driver has been loaded.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Antonio Ospite authored and Mauro Carvalho Chehab committed Oct 19, 2011
1 parent 899e3ee commit e58fced
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/video/v4l2-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void v4l2_device_release(struct device *cd)
* TODO: In the long run all drivers that use v4l2_device should use the
* v4l2_device release callback. This check will then be unnecessary.
*/
if (v4l2_dev->release == NULL)
if (v4l2_dev && v4l2_dev->release == NULL)
v4l2_dev = NULL;

/* Release video_device and perform other
Expand Down

0 comments on commit e58fced

Please sign in to comment.