summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2011-11-16 19:09:40 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-30 19:03:46 +0100
commitf0b7c7fc6f15e823cb4a5d225d9ef28b884ab6ec (patch)
treea460428bbaf613bc8e209e52fc13b2a6b713a673
parent[media] lgdt330x: warn on errors blasting modulation config to the lgdt3303 (diff)
downloadlinux-f0b7c7fc6f15e823cb4a5d225d9ef28b884ab6ec.tar.xz
linux-f0b7c7fc6f15e823cb4a5d225d9ef28b884ab6ec.zip
[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>
-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 95a3f5e82aef..4d22b8214f98 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;