Skip to content

Commit 43ec8a6

Browse files
committed
Merge tag 'unmap-fix-20230629' of git://git.infradead.org/users/dwmw2/linux
Pull mm fix from David Woodhouse: "Fix error return from do_vmi_align_munmap()" * tag 'unmap-fix-20230629' of git://git.infradead.org/users/dwmw2/linux: mm/mmap: Fix error return in do_vmi_align_munmap()
2 parents 3ad7b12 + 6c26bd4 commit 43ec8a6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mm/mmap.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,8 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
24892489
}
24902490
vma_start_write(next);
24912491
mas_set_range(&mas_detach, next->vm_start, next->vm_end - 1);
2492-
if (mas_store_gfp(&mas_detach, next, GFP_KERNEL))
2492+
error = mas_store_gfp(&mas_detach, next, GFP_KERNEL);
2493+
if (error)
24932494
goto munmap_gather_failed;
24942495
vma_mark_detached(next, true);
24952496
if (next->vm_flags & VM_LOCKED)
@@ -2542,12 +2543,12 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
25422543
BUG_ON(count != test_count);
25432544
}
25442545
#endif
2545-
/* Point of no return */
2546-
error = -ENOMEM;
25472546
vma_iter_set(vmi, start);
2548-
if (vma_iter_clear_gfp(vmi, start, end, GFP_KERNEL))
2547+
error = vma_iter_clear_gfp(vmi, start, end, GFP_KERNEL);
2548+
if (error)
25492549
goto clear_tree_failed;
25502550

2551+
/* Point of no return */
25512552
mm->locked_vm -= locked_vm;
25522553
mm->map_count -= count;
25532554
/*

0 commit comments

Comments
 (0)