提交 e58fced2 编写于 作者: A Antonio Ospite 提交者: Mauro Carvalho Chehab

[media] videodev: fix a NULL pointer dereference in v4l2_device_release()

The change in 8280b662 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: NAntonio Ospite <ospite@studenti.unina.it>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 899e3ee4
...@@ -181,7 +181,7 @@ static void v4l2_device_release(struct device *cd) ...@@ -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 * TODO: In the long run all drivers that use v4l2_device should use the
* v4l2_device release callback. This check will then be unnecessary. * 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; v4l2_dev = NULL;
/* Release video_device and perform other /* Release video_device and perform other
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册