Commit 2e7682eb authored by YueHaibing's avatar YueHaibing Committed by Mauro Carvalho Chehab

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: 34d1324e ("[media] pci: Add tw5864 driver")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent f8ee34c3
......@@ -1395,13 +1395,13 @@ static void tw5864_handle_frame(struct tw5864_h264_frame *frame)
input->vb = NULL;
spin_unlock_irqrestore(&input->slock, flags);
v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf);
if (!vb) { /* Gone because of disabling */
dev_dbg(&dev->pci->dev, "vb is empty, dropping frame\n");
return;
}
v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf);
/*
* Check for space.
* Mind the overhead of startcode emulation prevention.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment