Commit 068a0df7 authored by Seung-Woo Kim's avatar Seung-Woo Kim Committed by Mauro Carvalho Chehab

[media] media: vb2: add length check for mmap

The length of mmap() can be bigger than length of vb2 buffer, so
it should be checked.
Signed-off-by: default avatarSeung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 27a0aacf
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment