All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/page_table_check: fix accessing unmapped ptep
@ 2022-05-26 11:33 Miaohe Lin
  2022-05-26 13:04 ` Qi Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Miaohe Lin @ 2022-05-26 11:33 UTC (permalink / raw)
  To: akpm, pasha.tatashin; +Cc: rientjes, linux-mm, linux-kernel, linmiaohe

ptep is unmapped too early, so ptep will be accessed while it's unmapped.
Fix it by deferring pte_unmap() until page table checking is done.

Fixes: 80110bbfbba6 ("mm/page_table_check: check entries at pmd levels")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/page_table_check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_table_check.c b/mm/page_table_check.c
index 3692bea2ea2c..971c3129b0e3 100644
--- a/mm/page_table_check.c
+++ b/mm/page_table_check.c
@@ -234,11 +234,11 @@ void __page_table_check_pte_clear_range(struct mm_struct *mm,
 		pte_t *ptep = pte_offset_map(&pmd, addr);
 		unsigned long i;
 
-		pte_unmap(ptep);
 		for (i = 0; i < PTRS_PER_PTE; i++) {
 			__page_table_check_pte_clear(mm, addr, *ptep);
 			addr += PAGE_SIZE;
 			ptep++;
 		}
+		pte_unmap(ptep);
 	}
 }
-- 
2.23.0


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

end of thread, other threads:[~2022-05-27  1:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 11:33 [PATCH] mm/page_table_check: fix accessing unmapped ptep Miaohe Lin
2022-05-26 13:04 ` Qi Zheng
2022-05-26 13:11   ` Pasha Tatashin
2022-05-26 13:23     ` Qi Zheng
2022-05-26 13:17 ` Pasha Tatashin
2022-05-26 13:34 ` Matthew Wilcox
2022-05-26 13:37   ` Pasha Tatashin
2022-05-26 18:15     ` Andrew Morton
2022-05-26 18:31       ` Pasha Tatashin
2022-05-27  1:10         ` Miaohe Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.