]> 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)
commit83a8441f8d8e2e47e9bf2aead3aca625ab95d5ad
tree45c1465bb7ca23e8ff8520c827f39aca9cb5d0e4
parent3e732ebf7316ac83e8562db7e64cc68aec390a18
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: af28a988b313 ("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