aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2011-11-16 13:09:40 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-30 13:03:46 -0500
commitf0b7c7fc6f15e823cb4a5d225d9ef28b884ab6ec (patch)
treea460428bbaf613bc8e209e52fc13b2a6b713a673
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>
-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)
883 883
884 for (plane = 0; plane < vb->num_planes; ++plane) { 884 for (plane = 0; plane < vb->num_planes; ++plane) {
885 /* Skip the plane if already verified */ 885 /* Skip the plane if already verified */
886 if (vb->v4l2_planes[plane].m.userptr == planes[plane].m.userptr 886 if (vb->v4l2_planes[plane].m.userptr &&
887 vb->v4l2_planes[plane].m.userptr == planes[plane].m.userptr
887 && vb->v4l2_planes[plane].length == planes[plane].length) 888 && vb->v4l2_planes[plane].length == planes[plane].length)
888 continue; 889 continue;
889 890