Skip to content

Commit a1ee281

Browse files
npigginmpe
authored andcommitted
powerpc/64s/powernv: Fix memory corruption when saving SLB entries on MCE
This can be hit by an HPT guest running on an HPT host and bring down the host, so it's quite important to fix. Fixes: 7290f3b ("powerpc/64s/powernv: machine check dump SLB contents") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Acked-by: Mahesh Salgaonkar <mahesh@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201128070728.825934-2-npiggin@gmail.com
1 parent f54db39 commit a1ee281

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • arch/powerpc/platforms/powernv

arch/powerpc/platforms/powernv/setup.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,16 @@ static void __init pnv_init(void)
211211
add_preferred_console("hvc", 0, NULL);
212212

213213
if (!radix_enabled()) {
214+
size_t size = sizeof(struct slb_entry) * mmu_slb_size;
214215
int i;
215216

216217
/* Allocate per cpu area to save old slb contents during MCE */
217-
for_each_possible_cpu(i)
218-
paca_ptrs[i]->mce_faulty_slbs = memblock_alloc_node(mmu_slb_size, __alignof__(*paca_ptrs[i]->mce_faulty_slbs), cpu_to_node(i));
218+
for_each_possible_cpu(i) {
219+
paca_ptrs[i]->mce_faulty_slbs =
220+
memblock_alloc_node(size,
221+
__alignof__(struct slb_entry),
222+
cpu_to_node(i));
223+
}
219224
}
220225
}
221226

0 commit comments

Comments
 (0)