From: Antonio Ospite Date: Wed, 12 Oct 2011 20:59:26 +0000 (-0300) Subject: [media] videodev: fix a NULL pointer dereference in v4l2_device_release() X-Git-Tag: v3.12-rc1~4677^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e58fced201ad6e6cb673f07499919c3b20792d94;p=kernel%2Fkernel-generic.git [media] videodev: fix a NULL pointer dereference in v4l2_device_release() 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index d721565..a5c9ed1 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -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