]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mprotect: Fix adcfbd7698558a linked list removal
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 10 Feb 2021 14:33:59 +0000 (09:33 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 10 Feb 2021 14:45:34 +0000 (09:45 -0500)
Use mas_find() in do_mprotect_pkey to find the next vma to better align
with what happened with the old API

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

index d9479609f1b5dbff43a304727a8f35697880562a..5292675e29e4f60c08a17ff1416deffa8bd488ef 100644 (file)
@@ -550,8 +550,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
        if ((pkey != -1) && !mm_pkey_is_allocated(current->mm, pkey))
                goto out;
 
-       mas_set(&mas, start);
-       vma = mas_walk(&mas);
+       vma = mas_find(&mas, -1);
        error = -ENOMEM;
        if (!vma)
                goto out;
@@ -635,7 +634,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
                if (nstart >= end)
                        goto out;
 
-               vma = mas_next(&mas, ULONG_MAX);
+               vma = mas_next(&mas, -1);
                if (!vma || vma->vm_start != nstart) {
                        error = -ENOMEM;
                        goto out;