Skip to content

Commit

Permalink
Merge tag 'unmap-fix-20230629' of git://git.infradead.org/users/dwmw2…
Browse files Browse the repository at this point in the history
…/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()
  • Loading branch information
Linus Torvalds committed Jun 30, 2023
2 parents 3ad7b12 + 6c26bd4 commit 43ec8a6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,8 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
}
vma_start_write(next);
mas_set_range(&mas_detach, next->vm_start, next->vm_end - 1);
if (mas_store_gfp(&mas_detach, next, GFP_KERNEL))
error = mas_store_gfp(&mas_detach, next, GFP_KERNEL);
if (error)
goto munmap_gather_failed;
vma_mark_detached(next, true);
if (next->vm_flags & VM_LOCKED)
Expand Down Expand Up @@ -2542,12 +2543,12 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
BUG_ON(count != test_count);
}
#endif
/* Point of no return */
error = -ENOMEM;
vma_iter_set(vmi, start);
if (vma_iter_clear_gfp(vmi, start, end, GFP_KERNEL))
error = vma_iter_clear_gfp(vmi, start, end, GFP_KERNEL);
if (error)
goto clear_tree_failed;

/* Point of no return */
mm->locked_vm -= locked_vm;
mm->map_count -= count;
/*
Expand Down

0 comments on commit 43ec8a6

Please sign in to comment.