mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
ANDROID: fuse: Open-code vma_set_file() logic in fuse_backing_mmap()
Manual manipulation of vma->vm_file and file reference counts in fuse_backing_mmap() is error-prone. Open-code the logic of vma_set_file() using swap() to safely transfer the file reference and ensure proper reference counting during VMA setup, as vma_set_file() is not available in this kernel version. Bug: 498749316 Signed-off-by: Sandeep Dhavale <dhavale@google.com> Cherrypick-From: https://android-review.googlesource.com/q/commit:5c3d7b8761264e2a2deb121020bb933273b240ba Merged-In: I22ba0618f9fde6b698aeeeff2005830c4392969c Change-Id: I22ba0618f9fde6b698aeeeff2005830c4392969c [dhavale: as mentioned in updated commit message, this patch is adjusted to account for lack of vma_set_file() helper ]
This commit is contained in:
parent
e3b7b58b0a
commit
4884b8ae4c
1 changed files with 4 additions and 6 deletions
|
|
@ -1064,14 +1064,12 @@ ssize_t fuse_backing_mmap(struct file *file, struct vm_area_struct *vma)
|
|||
if (WARN_ON(file != vma->vm_file))
|
||||
return -EIO;
|
||||
|
||||
vma->vm_file = get_file(backing_file);
|
||||
|
||||
get_file(backing_file);
|
||||
swap(vma->vm_file, backing_file);
|
||||
fput(backing_file);
|
||||
ret = call_mmap(vma->vm_file, vma);
|
||||
|
||||
if (ret)
|
||||
fput(backing_file);
|
||||
else
|
||||
fput(file);
|
||||
return ret;
|
||||
|
||||
if (file->f_flags & O_NOATIME)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue