Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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 <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Philipp Zabel and committed by
Mauro Carvalho Chehab
dc77523c 8ca5d2d8

+2 -1
+2 -1
drivers/media/v4l2-core/videobuf2-core.c
··· 241 241 q->bufs[q->num_buffers + buffer] = vb; 242 242 } 243 243 244 - __setup_offsets(q, buffer); 244 + if (memory == V4L2_MEMORY_MMAP) 245 + __setup_offsets(q, buffer); 245 246 246 247 dprintk(1, "Allocated %d buffers, %d plane(s) each\n", 247 248 buffer, num_planes);