[PATCH] mmap: Remove unroll from __vma_adjust()

From: Liam Howlett
Date: Tue Jul 19 2022 - 14:50:11 EST


If __vma_adjust() fails, then there is no reason to undo the anon vma
work since it will be done in the caller or we have been OOMed.

Fixes: 83651ef5048d (mm: start tracking VMAs with maple tree)
Suggested-by: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
---
mm/mmap.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index eed9e9d96e22..87e9e78b03c8 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -970,12 +970,8 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
}
}
vma_adjust_trans_huge(orig_vma, start, end, adjust_next);
-
- if (mas_preallocate(&mas, vma, GFP_KERNEL)) {
- if (exporter && exporter->anon_vma)
- unlink_anon_vmas(importer);
+ if (mas_preallocate(&mas, vma, GFP_KERNEL))
return -ENOMEM;
- }

if (file) {
mapping = file->f_mapping;
--
2.35.1