From 32f0fa685cf9ddcfbbb30c7add0edea71103a9b6 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Wed, 30 Jun 2021 17:10:41 +0000 Subject: [PATCH] Revert "ANDROID: dma-buf: Don't change vm_ops if vm_file changes" This reverts commit fca37c251af3c542ba8b9786143188ce9cd51989. 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 Change-Id: I52fb55e1048a151fae7641c9646a231d59b3224d --- drivers/dma-buf/dma-buf.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 9ca8f84732b3..0ab865543d1f 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -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);