]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/64s/radix: Fix radix_kvm_prefetch_workaround paca access of not possible CPU
authorNicholas Piggin <npiggin@gmail.com>
Tue, 12 Jun 2018 09:38:08 +0000 (19:38 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 19 Jun 2018 23:13:25 +0000 (09:13 +1000)
If possible CPUs are limited (e.g., by kexec), then the kvm prefetch
workaround function can access the paca pointer for a !possible CPU.

Fixes: d2e60075a3d44 ("powerpc/64: Use array of paca pointers and allocate pacas individually")
Cc: stable@kernel.org
Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
Tested-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/tlb-radix.c

index a734e486664de464847be2f5fb7a16978687464e..1135b43a597c5045be9a0425b67a5e5edd17d876 100644 (file)
@@ -1097,6 +1097,8 @@ extern void radix_kvm_prefetch_workaround(struct mm_struct *mm)
                for (; sib <= cpu_last_thread_sibling(cpu) && !flush; sib++) {
                        if (sib == cpu)
                                continue;
+                       if (!cpu_possible(sib))
+                               continue;
                        if (paca_ptrs[sib]->kvm_hstate.kvm_vcpu)
                                flush = true;
                }