From dc77523c5da5513df1bbc74db2a522a94f4cec0e Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Thu, 19 Sep 2013 04:37:29 -0300
Subject: [media] videobuf2-core: call __setup_offsets only for mmap memory
type
__setup_offsets fills the v4l2_planes' mem_offset fields, which is only valid
for V4L2_MEMORY_MMAP type buffers. For V4L2_MEMORY_DMABUF and _USERPTR buffers,
this incorrectly overwrites the fd and userptr fields.
Reported-by: Michael Olbrich
Signed-off-by: Philipp Zabel
Acked-by: Marek Szyprowski
Acked-by: Pawel Osciak
Acked-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
---
drivers/media/v4l2-core/videobuf2-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'drivers/media/v4l2-core')
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index fc8af507beac..91412d463ba0 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -241,7 +241,8 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum v4l2_memory memory,
q->bufs[q->num_buffers + buffer] = vb;
}
- __setup_offsets(q, buffer);
+ if (memory == V4L2_MEMORY_MMAP)
+ __setup_offsets(q, buffer);
dprintk(1, "Allocated %d buffers, %d plane(s) each\n",
buffer, num_planes);
--
cgit v1.2.3