summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2011-11-16 15:09:40 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-30 16:03:46 -0200
commitf0b7c7fc6f15e823cb4a5d225d9ef28b884ab6ec (patch)
treea460428bbaf613bc8e209e52fc13b2a6b713a673 /drivers
parent54828d19f82be0d62e22fbd5a6354136c50a20eb (diff)
[media] media: vb2: fix queueing of userptr buffers with null buffer pointer
Heuristic that checks if the memory pointer has been changed lacked a check if the pointer was actually provided by the userspace, what allowed one to queue a NULL pointer which was accepted without further checking. This patch fixes this issue. Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/videobuf2-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index 95a3f5e82ae..4d22b8214f9 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -883,7 +883,8 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const struct v4l2_buffer *b)
for (plane = 0; plane < vb->num_planes; ++plane) {
/* Skip the plane if already verified */
- if (vb->v4l2_planes[plane].m.userptr == planes[plane].m.userptr
+ if (vb->v4l2_planes[plane].m.userptr &&
+ vb->v4l2_planes[plane].m.userptr == planes[plane].m.userptr
&& vb->v4l2_planes[plane].length == planes[plane].length)
continue;