]> git.baikalelectronics.ru Git - kernel.git/commit
mm/huge_memory: Avoid calling pmd_page() on a non-leaf PMD
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 6 Apr 2022 12:41:39 +0000 (08:41 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 7 Apr 2022 13:43:41 +0000 (09:43 -0400)
commit41662f1a0b52eb078ad423c2a5007cc09fe4a189
tree45c1465bb7ca23e8ff8520c827f39aca9cb5d0e4
parent2eaacd3bf407bb197ac1020e845a34bff277838d
mm/huge_memory: Avoid calling pmd_page() on a non-leaf PMD

Calling try_to_unmap() with TTU_SPLIT_HUGE_PMD and a folio that's not
mapped by a PMD causes oopses on arm64 because we now call page_folio()
on an invalid page.  pmd_page() returns a valid page for non-leaf PMDs on
some architectures, so this bug escaped testing before now.  Fix this bug
by delaying the call to pmd_page() until after we know the PMD is a leaf.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215804
Fixes: b010b2f5e16f ("mm/huge_memory: Convert __split_huge_pmd() to take a folio")
Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: Zorro Lang <zlang@redhat.com>
mm/huge_memory.c