summaryrefslogtreecommitdiff
path: root/mm/vma.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vma.c')
-rw-r--r--mm/vma.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/vma.c b/mm/vma.c
index 7a908a964d18d..690e68931868d 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -2774,6 +2774,13 @@ unacct_error:
if (map.charged)
vm_unacct_memory(map.charged);
abort_munmap:
+ /*
+ * This indicates that .mmap_prepare has set a new file, differing from
+ * desc->vm_file. But since we're aborting the operation, only the
+ * original file will be cleaned up. Ensure we clean up both.
+ */
+ if (map.file_doesnt_need_get)
+ fput(map.file);
vms_abort_munmap_vmas(&map.vms, &map.mas_detach);
return error;
}