Skip to content

Commit 650768c

Browse files
Dev Jainwilldeacon
authored andcommitted
arm64: Restrict pagetable teardown to avoid false warning
Commit 9c00697 ("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: 9c00697 ("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>
1 parent c0c7fa4 commit 650768c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,8 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr)
13051305
next = addr;
13061306
end = addr + PUD_SIZE;
13071307
do {
1308-
pmd_free_pte_page(pmdp, next);
1308+
if (pmd_present(pmdp_get(pmdp)))
1309+
pmd_free_pte_page(pmdp, next);
13091310
} while (pmdp++, next += PMD_SIZE, next != end);
13101311

13111312
pud_clear(pudp);

0 commit comments

Comments
 (0)