]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64: Restrict pagetable teardown to avoid false warning
authorDev Jain <dev.jain@arm.com>
Tue, 27 May 2025 08:26:33 +0000 (13:56 +0530)
committerWill Deacon <will@kernel.org>
Thu, 12 Jun 2025 14:53:38 +0000 (15:53 +0100)
commit650768c512faba8070bf4cfbb28c95eb5cd203f3
tree38041388a01f8aeb23a71603ef37210b4d128fd8
parentc0c7fa4e7a512006710c8e4d6b6f7b40c9f786cd
arm64: Restrict pagetable teardown to avoid false warning

Commit 9c006972c3fe ("arm64: mmu: drop pXd_present() checks from
pXd_free_pYd_table()") removes the pxd_present() checks because the
caller checks pxd_present(). But, in case of vmap_try_huge_pud(), the
caller only checks pud_present(); pud_free_pmd_page() recurses on each
pmd through pmd_free_pte_page(), wherein the pmd may be none. Thus it is
possible to hit a warning in the latter, since pmd_none => !pmd_table().
Thus, add a pmd_present() check in pud_free_pmd_page().

This problem was found by code inspection.

Fixes: 9c006972c3fe ("arm64: mmu: drop pXd_present() checks from pXd_free_pYd_table()")
Cc: stable@vger.kernel.org
Reported-by: Ryan Roberts <ryan.roberts@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Link: https://lore.kernel.org/r/20250527082633.61073-1-dev.jain@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/mm/mmu.c