Skip to contentSkip to conversation

mm-rmap-fix-potential-pte_unmap-on-an-not-mapped-pte.patch removed from -mm tree

merged [email protected] 1 participant 1 message Feb 27, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/rmap: fix potential pte_unmap on an not mapped pte
has been removed from the -mm tree. Its filename was
mm-rmap-fix-potential-pte_unmap-on-an-not-mapped-pte.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Miaohe Lin <[email protected]>
Subject: mm/rmap: fix potential pte_unmap on an not mapped pte

For PMD-mapped page (usually THP), pvmw->pte is NULL. For PTE-mapped THP, pvmw->pte is mapped. But for HugeTLB pages, pvmw->pte is not mapped and set to the relevant page table entry. So in page_vma_mapped_walk_done(), we may do pte_unmap() for HugeTLB pte which is not mapped. Fix this by checking pvmw->page against PageHuge before trying to do pte_unmap().

Fixes ace71a19cec5 ("mm: introduce page_vma_mapped_walk()")
Cc Kees Cook <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc "Kirill A. Shutemov" <[email protected]>
Cc Wei Yang <[email protected]>
Cc Dmitry Safonov <[email protected]>
Cc Brian Geffon <[email protected]>

---

 include/linux/rmap.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/rmap.h renamed from include/linux/rmap.h~mm-rmap-fix-potential-pte_unmap-on-an-not-mapped-pte +2 -1
@@ -213,7 +213,8 @@ struct page_vma_mapped_walk {
 
 static inline void page_vma_mapped_walk_done(struct page_vma_mapped_walk *pvmw)
 {
-	if (pvmw->pte)
+	/* HugeTLB pte is set to the relevant page table entry without pte_mapped. */
+	if (pvmw->pte && !PageHuge(pvmw->page))
 		pte_unmap(pvmw->pte);
 	if (pvmw->ptl)
 		spin_unlock(pvmw->ptl);

_

Patches currently in -mm which might be from [email protected] are