]> 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>
Mon, 9 Nov 2020 19:45:37 +0000 (14:45 -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 b60891d00fc8f3e3bd92e9d72d74d8958bcd8a10..43100c78ed3aa0a9216433216a6c5fd13714ac10 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2853,8 +2853,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;
        }
 
@@ -2864,6 +2864,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);