Commit 8526e973 authored by Dmitry Osipenko's avatar Dmitry Osipenko

dma-buf: Move dma_buf_mmap_internal() to dynamic locking specification

All dma-buf functions has been moved to dynamic locking specification
The dma_buf_mmap_internal() was missed out by accident. Take reservation
lock around file mapping operation to adhere the common locking convention.
Reported-by: default avatarDaniel Vetter <daniel@ffwll.ch>
Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221110201349.351294-2-dmitry.osipenko@collabora.com
parent 9df38728
...@@ -129,6 +129,7 @@ static struct file_system_type dma_buf_fs_type = { ...@@ -129,6 +129,7 @@ static struct file_system_type dma_buf_fs_type = {
static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
{ {
struct dma_buf *dmabuf; struct dma_buf *dmabuf;
int ret;
if (!is_dma_buf_file(file)) if (!is_dma_buf_file(file))
return -EINVAL; return -EINVAL;
...@@ -144,7 +145,11 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) ...@@ -144,7 +145,11 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
dmabuf->size >> PAGE_SHIFT) dmabuf->size >> PAGE_SHIFT)
return -EINVAL; return -EINVAL;
return dmabuf->ops->mmap(dmabuf, vma); dma_resv_lock(dmabuf->resv, NULL);
ret = dmabuf->ops->mmap(dmabuf, vma);
dma_resv_unlock(dmabuf->resv);
return ret;
} }
static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence) static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment