Skip to content

Commit 79c4c72

Browse files
Sebastian EneMarc Zyngier
authored andcommitted
arm64: ptdump: Don't override the level when operating on the stage-2 tables
Ptdump uses the init_mm structure directly to dump the kernel pagetables. When ptdump is called on the stage-2 pagetables, this mm argument is not used. Prevent the level from being overwritten by checking the argument against NULL. Signed-off-by: Sebastian Ene <[email protected]> Acked-by: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 9182301 commit 79c4c72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/mm/ptdump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
197197
u64 prot = 0;
198198

199199
/* check if the current level has been folded dynamically */
200-
if ((level == 1 && mm_p4d_folded(st->mm)) ||
201-
(level == 2 && mm_pud_folded(st->mm)))
200+
if (st->mm && ((level == 1 && mm_p4d_folded(st->mm)) ||
201+
(level == 2 && mm_pud_folded(st->mm))))
202202
level = 0;
203203

204204
if (level >= 0)

0 commit comments

Comments
 (0)