Skip to content

Commit 2e7682e

Browse files
YueHaibingmchehab
YueHaibing
authored andcommitted
media: tw5864: Fix possible NULL pointer dereference in tw5864_handle_frame
'vb' null check should be done before dereferencing it in tw5864_handle_frame, otherwise a NULL pointer dereference may occur. Fixes: 34d1324 ("[media] pci: Add tw5864 driver") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1 parent f8ee34c commit 2e7682e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: drivers/media/pci/tw5864/tw5864-video.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1395,13 +1395,13 @@ static void tw5864_handle_frame(struct tw5864_h264_frame *frame)
13951395
input->vb = NULL;
13961396
spin_unlock_irqrestore(&input->slock, flags);
13971397

1398-
v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf);
1399-
14001398
if (!vb) { /* Gone because of disabling */
14011399
dev_dbg(&dev->pci->dev, "vb is empty, dropping frame\n");
14021400
return;
14031401
}
14041402

1403+
v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf);
1404+
14051405
/*
14061406
* Check for space.
14071407
* Mind the overhead of startcode emulation prevention.

0 commit comments

Comments
 (0)