summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2014-08-25 15:57:59 +0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-22 03:12:49 +0400
commit12561ad622de254d69ec1baaf6734afc602a2c30 (patch)
tree32c93ebb4cf508eaf4fe1b19a26379b683fdcd34 /drivers/media/v4l2-core
parent825fd08dbbd830b3f42e0f014f4c9f6eba5c434c (diff)
downloadlinux-12561ad622de254d69ec1baaf6734afc602a2c30.tar.xz
[media] videobuf2-core: take mmap_sem before calling __qbuf_userptr
(Changes since v2: dropped local variable as suggested by Laurent) Commit f035eb4e976ef5a059e30bc91cfd310ff030a7d3 (videobuf2: fix lockdep warning) unfortunately removed the mmap_sem lock that is needed around the call to __qbuf_userptr. Amazingly nobody noticed this (especially me as the author) until Jan Kara pointed this out to me. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Jan Kara <jack@suse.cz> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 7e6aff673a5a..15b02f940ced 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1627,7 +1627,9 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b)
ret = __qbuf_mmap(vb, b);
break;
case V4L2_MEMORY_USERPTR:
+ down_read(&current->mm->mmap_sem);
ret = __qbuf_userptr(vb, b);
+ up_read(&current->mm->mmap_sem);
break;
case V4L2_MEMORY_DMABUF:
ret = __qbuf_dmabuf(vb, b);