aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/android
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2020-09-14 15:09:33 +0200
committerChristian König <christian.koenig@amd.com>2020-11-05 13:03:52 +0100
commit2b5b95b1ff3d70a95013a45e3b5b90f1daf42348 (patch)
tree0d0d804862b63c20500e6e947931d18f440dbb45 /drivers/staging/android
parentmm: mmap: fix fput in error path v2 (diff)
downloadlinux-dev-2b5b95b1ff3d70a95013a45e3b5b90f1daf42348.tar.xz
linux-dev-2b5b95b1ff3d70a95013a45e3b5b90f1daf42348.zip
mm: introduce vma_set_file function v4
Add the new vma_set_file() function to allow changing vma->vm_file with the necessary refcount dance. v2: add more users of this. v3: add missing EXPORT_SYMBOL, rebase on mmap cleanup, add comments why we drop the reference on two occasions. v4: make it clear that changing an anonymous vma is illegal. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://patchwork.freedesktop.org/patch/394773/
Diffstat (limited to 'drivers/staging/android')
-rw-r--r--drivers/staging/android/ashmem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 10b4be1f3e78..4789d36ddfd3 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -450,9 +450,9 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
vma_set_anonymous(vma);
}
- if (vma->vm_file)
- fput(vma->vm_file);
- vma->vm_file = asma->file;
+ vma_set_file(vma, asma->file);
+ /* XXX: merge this with the get_file() above if possible */
+ fput(asma->file);
out:
mutex_unlock(&ashmem_mutex);