diff mbox

[v3,13/22] media: Change v4l-core to check if source is free

Message ID 56D8AAEC.8050204@osg.samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shuah Khan March 3, 2016, 9:21 p.m. UTC
On 03/03/2016 02:18 PM, Shuah Khan wrote:
> On 03/03/2016 01:39 PM, Olli Salonen wrote:
>> Hello Shuah,
>>
>> This patch seems to cause issues with my setup. Basically, when I try
>> to tune to a channel, I get an oops. I'm using TechnoTrend CT2-4650
>> PCIe DVB-T tuner (cx23885).
>>
>> Here's the oops:
>>
>> [  548.443272] BUG: unable to handle kernel NULL pointer dereference
>> at 0000000000000010
>> [  548.452036] IP: [<ffffffffc020ffc9>]
>> v4l_vb2q_enable_media_source+0x9/0x50 [videodev]
> 
> Hi Olli,
> 
> Will you be able to use gdb and tell me which source line is
> the cause? Could you give this following patch a try and if it
> fixes the problem?
> 
> thanks,
> -- Shuah
> 

Sorry - diff included twice: here is the correct diff:
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c
index 643686d..a39a3cd 100644
--- a/drivers/media/v4l2-core/v4l2-mc.c
+++ b/drivers/media/v4l2-core/v4l2-mc.c
@@ -214,6 +214,8 @@  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);