Revert "ANDROID: dma-buf: Don't change vm_ops if vm_file changes"

This reverts commit fca37c251a.

Reason for revert: mmap_count is no longer used for reporting dma-bufs and introduces subtle bugs related to changing the vm_ops

Bug: 192459295
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Change-Id: I52fb55e1048a151fae7641c9646a231d59b3224d
This commit is contained in:
Kalesh Singh
2021-06-30 17:10:41 +00:00
committed by Todd Kjos
parent f45304d091
commit 32f0fa685c

View File

@@ -173,17 +173,12 @@ static void dma_buf_vma_close(struct vm_area_struct *vma)
static int dma_buf_do_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
{
int ret;
struct file *orig_vm_file = vma->vm_file;
/* call this first because the exporter might override vma->vm_ops */
ret = dmabuf->ops->mmap(dmabuf, vma);
int ret = dmabuf->ops->mmap(dmabuf, vma);
if (ret)
return ret;
if (orig_vm_file != vma->vm_file)
return 0;
/* save the exporter provided vm_ops */
dmabuf->exp_vm_ops = vma->vm_ops;
dmabuf->vm_ops = *(dmabuf->exp_vm_ops);