linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/mprotect: Fix maple tree start address in do_mprotect_pkey()
@ 2022-08-25 20:30 Liam Howlett
  2022-08-26  1:06 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Liam Howlett @ 2022-08-25 20:30 UTC (permalink / raw)
  To: maple-tree, linux-mm, linux-kernel, Andrew Morton,
	Stephen Rothwell, Linux Next Mailing List, Mark Brown,
	Will Deacon, Catalin Marinas
  Cc: Liam Howlett

Use the untagged_addr() instead of the address passed into the function.

Fixes: 3338b715d25d (mm/mprotect: use maple tree navigation instead of vma linked list)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 mm/mprotect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/mprotect.c b/mm/mprotect.c
index f2b9b1da9083..3c79796be65e 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -675,7 +675,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
 	const bool rier = (current->personality & READ_IMPLIES_EXEC) &&
 				(prot & PROT_READ);
 	struct mmu_gather tlb;
-	MA_STATE(mas, &current->mm->mm_mt, start, start);
+	MA_STATE(mas, &current->mm->mm_mt, 0, 0);
 
 	start = untagged_addr(start);
 
@@ -707,6 +707,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_find(&mas, ULONG_MAX);
 	error = -ENOMEM;
 	if (!vma)
-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-26  3:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 20:30 [PATCH] mm/mprotect: Fix maple tree start address in do_mprotect_pkey() Liam Howlett
2022-08-26  1:06 ` Andrew Morton
2022-08-26  3:27   ` Liam Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox