]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap: Fix do_brk_munmap() multiple pages.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 9 Nov 2020 19:45:37 +0000 (14:45 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:30:41 +0000 (12:30 -0500)
This is rare, so just use the slower __do_munmap()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/mmap.c

index 25ac50c669d4a394f9fae4c800d96a9f91eeedcd..1036a6b7146acbc36a26142f83ff0f6b9d193ae9 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2861,8 +2861,8 @@ static int do_brk_munmap(struct ma_state *mas, struct vm_area_struct *vma,
 
        arch_unmap(mm, newbrk, oldbrk);
 
-       if (vma->vm_start >= newbrk) { // remove entire mapping.
-               ret = __do_munmap(mm, newbrk, oldbrk - newbrk, &uf, true);
+       if (vma->vm_start >= newbrk) { // remove entire mapping(s)
+               ret = __do_munmap(mm, newbrk, oldbrk-newbrk, uf, true);
                goto munmap_full_vma;
        }
 
@@ -2872,6 +2872,7 @@ static int do_brk_munmap(struct ma_state *mas, struct vm_area_struct *vma,
        ret = userfaultfd_unmap_prep(&unmap, newbrk, oldbrk, uf);
        if (ret)
                return ret;
+       ret = 1;
 
        // Change the oldbrk of vma to the newbrk of the munmap area
        vma_adjust_trans_huge(vma, vma->vm_start, newbrk, 0);