]> git.karo-electronics.de Git - linux-beck.git/commit
[media] videobuf2-core: fix plane_sizes handling in VIDIOC_CREATE_BUFS
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 20 Nov 2015 11:40:14 +0000 (09:40 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 18 Dec 2015 16:05:58 +0000 (14:05 -0200)
commit58e1ba3ce6b2c8f4933525d8bb939605add22c83
treea1ffcb59d5cfe249d08175ba9a642fe60a771ff3
parent20eedf0e16918069241ec16b1bf003325016ed6e
[media] videobuf2-core: fix plane_sizes handling in VIDIOC_CREATE_BUFS

The handling of q->plane_sizes was wrong in vb2_core_create_bufs().
The q->plane_sizes array was global and it was overwritten by create_bufs.
So if reqbufs was called with e.g. size 100000 then q->plane_sizes[0] would
be set to 100000. If create_bufs was called afterwards with size 200000,
then q->plane_sizes[0] would be overwritten with the new value. Calling
create_bufs again for size 100000 would cause an error since 100000 is now
less than q->plane_sizes[0].

This patch fixes this problem by 1) removing q->plane_sizes and using the
vb->planes[].length field instead, and 2) by introducing a min_length field
in struct vb2_plane. This field is set to the plane size as returned by
the queue_setup op and is the minimum required plane size. So user pointers
or dmabufs should all be at least this size.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/videobuf2-core.c
include/media/videobuf2-core.h