Skip to content

Commit 9864816

Browse files
chleroympe
authored andcommitted
powerpc/book3e: Fix PUD allocation size in map_kernel_page()
Commit 2fb4706 ("powerpc: add support for folded p4d page tables") erroneously changed PUD setup to a mix of PMD and PUD. Fix it. While at it, use PTE_TABLE_SIZE instead of PAGE_SIZE for PTE tables in order to avoid any confusion. Fixes: 2fb4706 ("powerpc: add support for folded p4d page tables") Cc: stable@vger.kernel.org # v5.8+ Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Acked-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/95ddfd6176d53e6c85e13bd1c358359daa56775f.1655974558.git.christophe.leroy@csgroup.eu
1 parent 19fc5bb commit 9864816

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/powerpc/mm/nohash/book3e_pgtable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
9696
pgdp = pgd_offset_k(ea);
9797
p4dp = p4d_offset(pgdp, ea);
9898
if (p4d_none(*p4dp)) {
99-
pmdp = early_alloc_pgtable(PMD_TABLE_SIZE);
100-
p4d_populate(&init_mm, p4dp, pmdp);
99+
pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
100+
p4d_populate(&init_mm, p4dp, pudp);
101101
}
102102
pudp = pud_offset(p4dp, ea);
103103
if (pud_none(*pudp)) {
@@ -106,7 +106,7 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
106106
}
107107
pmdp = pmd_offset(pudp, ea);
108108
if (!pmd_present(*pmdp)) {
109-
ptep = early_alloc_pgtable(PAGE_SIZE);
109+
ptep = early_alloc_pgtable(PTE_TABLE_SIZE);
110110
pmd_populate_kernel(&init_mm, pmdp, ptep);
111111
}
112112
ptep = pte_offset_kernel(pmdp, ea);

0 commit comments

Comments
 (0)