Skip to content

Commit

Permalink
[media] media: vb2: fix queueing of userptr buffers with null buffer …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Marek Szyprowski authored and Mauro Carvalho Chehab committed Dec 30, 2011
1 parent 54828d1 commit f0b7c7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/media/video/videobuf2-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit f0b7c7f

Please sign in to comment.