Skip to content

Commit 6431636

Browse files
npiggingregkh
authored andcommitted
powerpc/64s/powernv: Fix memory corruption when saving SLB entries on MCE
commit a1ee281 upstream. 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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 05b9eff commit 6431636

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
@@ -186,11 +186,16 @@ static void __init pnv_init(void)
186186
add_preferred_console("hvc", 0, NULL);
187187

188188
if (!radix_enabled()) {
189+
size_t size = sizeof(struct slb_entry) * mmu_slb_size;
189190
int i;
190191

191192
/* Allocate per cpu area to save old slb contents during MCE */
192-
for_each_possible_cpu(i)
193-
paca_ptrs[i]->mce_faulty_slbs = memblock_alloc_node(mmu_slb_size, __alignof__(*paca_ptrs[i]->mce_faulty_slbs), cpu_to_node(i));
193+
for_each_possible_cpu(i) {
194+
paca_ptrs[i]->mce_faulty_slbs =
195+
memblock_alloc_node(size,
196+
__alignof__(struct slb_entry),
197+
cpu_to_node(i));
198+
}
194199
}
195200
}
196201

0 commit comments

Comments
 (0)