From 12561ad622de254d69ec1baaf6734afc602a2c30 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 25 Aug 2014 08:57:59 -0300 Subject: [PATCH] [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 Reported-by: Jan Kara Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 2 ++ 1 file changed, 2 insertions(+) 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(¤t->mm->mmap_sem); ret = __qbuf_userptr(vb, b); + up_read(¤t->mm->mmap_sem); break; case V4L2_MEMORY_DMABUF: ret = __qbuf_dmabuf(vb, b); -- 2.20.1