upstream: [media] media: vb2: Take queue or device lock in mmap-related vb2 ioctl...
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 2 Aug 2013 16:55:21 +0000 (13:55 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:51:34 +0000 (11:51 +0900)
commitf881d610391ad2d4b360b6f4ee36e5703394e283
tree97837e852c3e6b28de5b72bc444748108fc4689b
parent86efec46cd9c37c85507a23a15b529fd5b9fcbce
upstream: [media] media: vb2: Take queue or device lock in mmap-related vb2 ioctl handlers

The vb2_fop_mmap() and vb2_fop_get_unmapped_area() functions are plug-in
implementation of the mmap() and get_unmapped_area() file operations
that calls vb2_mmap() and vb2_get_unmapped_area() on the queue
associated with the video device. Neither the
vb2_fop_mmap/vb2_fop_get_unmapped_area nor the
v4l2_mmap/vb2_get_unmapped_area functions in the V4L2 core take any
lock, leading to race conditions between mmap/get_unmapped_area and
other buffer-related ioctls such as VIDIOC_REQBUFS.
Fix it by taking the queue or device lock around the vb2_mmap() and
vb2_get_unmapped_area() calls.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/videobuf2-core.c