linux-stable/arch/powerpc
Michael Ellerman 3fcad718b5 powerpc/powernv: Avoid crashing if rng is NULL
commit 90b5d4fe0b upstream.

On a bare-metal Power8 system that doesn't have an "ibm,power-rng", a
malicious QEMU and guest that ignore the absence of the
KVM_CAP_PPC_HWRNG flag, and calls H_RANDOM anyway, will dereference a
NULL pointer.

In practice all Power8 machines have an "ibm,power-rng", but let's not
rely on that, add a NULL check and early return in
powernv_get_random_real_mode().

Fixes: e928e9cb36 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM implementation.")
Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220727143219.2684192-1-mpe@ellerman.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-17 15:13:57 +02:00
..
boot powerpc updates for 5.19 2022-05-28 11:27:17 -07:00
configs powerpc: Restore CONFIG_DEBUG_INFO in defconfigs 2022-08-17 15:13:56 +02:00
crypto powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
include mmu_gather: Remove per arch tlb_{start,end}_vma() 2022-07-21 10:50:13 -07:00
kernel powerpc/64s: Disable stack variable initialisation for prom_init 2022-07-20 15:13:02 +10:00
kexec powerpc/kasan: Mark more real-mode code as not to be instrumented 2022-05-29 10:30:42 +10:00
kvm powerpc: Fix all occurences of "the the" 2022-05-22 15:59:43 +10:00
lib powerpc updates for 5.19 2022-05-28 11:27:17 -07:00
math-emu
mm powerpc/ptdump: Fix display of RW pages on FSL_BOOK3E 2022-08-17 15:13:57 +02:00
net powerpc/inst: Remove PPC_INST_BL 2022-05-22 15:58:27 +10:00
perf powerpc/perf: Fix the threshold compare group constraint for power9 2022-05-22 15:58:30 +10:00
platforms powerpc/powernv: Avoid crashing if rng is NULL 2022-08-17 15:13:57 +02:00
purgatory
sysdev powerpc/fsl-pci: Fix Class Code of PCIe Root Port 2022-08-17 15:13:57 +02:00
tools powerpc/64: Add UADDR64 relocation support 2022-03-09 21:47:53 +11:00
xmon More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
Kbuild
Kconfig powerpc fixes for 5.19 #6 2022-07-29 09:57:07 -07:00
Kconfig.debug powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
Makefile powerpc updates for 5.19 2022-05-28 11:27:17 -07:00
Makefile.postlink