From: Shuah Khan Date: Fri, 4 Mar 2016 02:24:58 +0000 (-0300) Subject: [media] media: fix null pointer dereference in v4l_vb2q_enable_media_source() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7e53898a761d192f0ee3e6d6a5dfef0532212754;p=linux-beck.git [media] media: fix null pointer dereference in v4l_vb2q_enable_media_source() Fix the null pointer dereference in v4l_vb2q_enable_media_source(). DVB only drivers don't have valid struct v4l2_fh pointer. [ 548.443272] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 [ 548.452036] IP: [] v4l_vb2q_enable_media_source+0x9/0x50 [videodev] [ 548.460792] PGD b820e067 PUD bb3df067 PMD 0 [ 548.465582] Oops: 0000 [#1] SMP Signed-off-by: Shuah Khan Reported-by: Olli Salonen Tested-by: Olli Salonen Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index 7291018cf1bf..f8b6e3be634f 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -240,7 +240,9 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q) { struct v4l2_fh *fh = q->owner; - return v4l_enable_media_source(fh->vdev); + if (fh && fh->vdev) + return v4l_enable_media_source(fh->vdev); + return 0; } EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source);