Skip to content

Commit

Permalink
[media] media: vb2: add length check for mmap
Browse files Browse the repository at this point in the history
The length of mmap() can be bigger than length of vb2 buffer, so
it should be checked.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Seung-Woo Kim authored and Mauro Carvalho Chehab committed Apr 15, 2013
1 parent 27a0aac commit 068a0df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/media/v4l2-core/videobuf2-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,11 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)

vb = q->bufs[buffer];

if (vb->v4l2_planes[plane].length < (vma->vm_end - vma->vm_start)) {
dprintk(1, "Invalid length\n");
return -EINVAL;
}

ret = call_memop(q, mmap, vb->planes[plane].mem_priv, vma);
if (ret)
return ret;
Expand Down

0 comments on commit 068a0df

Please sign in to comment.