From 5063e3169f3ff37e67fa461234e78744ca2d7ae5 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 10 Feb 2021 09:33:59 -0500 Subject: [PATCH] mm/mprotect: Fix adcfbd7698558a linked list removal 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 --- mm/mprotect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/mprotect.c b/mm/mprotect.c index d9479609f1b5d..5292675e29e4f 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -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; -- 2.50.1