videobuf2-core: take mmap_sem before calling __qbuf_userptr
PATCH v3 1/1 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 <[email protected]>
Reported-by Jan Kara <[email protected]>
Acked-by Laurent Pinchart <[email protected]>
--- drivers/media/v4l2-core/videobuf2-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/v4l2-core/videobuf2-core.c +2 -0
@@ -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);
Signature · 1 line
2.1.0.rc1