Skip to content

Commit fac880c

Browse files
mrutland-armwildea01
authored andcommitted
arm64: fix erroneous warnings in page freeing functions
In pmd_free_pte_page() and pud_free_pmd_page() we try to warn if they hit a present non-table entry. In both cases we'll warn for non-present entries, as the VM_WARN_ON() only checks the entry is not a table entry. This has been observed to result in warnings when booting a v4.19-rc2 kernel under qemu. Fix this by bailing out earlier for non-present entries. Fixes: ec28bb9 ("arm64: Implement page table free interfaces") Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 5736184 commit fac880c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/arm64/mm/mmu.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,9 @@ int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr)
985985

986986
pmd = READ_ONCE(*pmdp);
987987

988-
/* No-op for empty entry and WARN_ON for valid entry */
989-
if (!pmd_present(pmd) || !pmd_table(pmd)) {
988+
if (!pmd_present(pmd))
989+
return 1;
990+
if (!pmd_table(pmd)) {
990991
VM_WARN_ON(!pmd_table(pmd));
991992
return 1;
992993
}
@@ -1007,8 +1008,9 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr)
10071008

10081009
pud = READ_ONCE(*pudp);
10091010

1010-
/* No-op for empty entry and WARN_ON for valid entry */
1011-
if (!pud_present(pud) || !pud_table(pud)) {
1011+
if (!pud_present(pud))
1012+
return 1;
1013+
if (!pud_table(pud)) {
10121014
VM_WARN_ON(!pud_table(pud));
10131015
return 1;
10141016
}

0 commit comments

Comments
 (0)