linux-stable/arch/powerpc/platforms
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
..
4xx powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
8xx powerpc/8xx: Use kmalloced data structure instead of global static 2022-05-11 23:06:40 +10:00
40x powerpc: Remove asm/prom.h from all files that don't need it 2022-05-08 22:15:04 +10:00
44x powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
52xx powerpc: Fix all occurences of "the the" 2022-05-22 15:59:43 +10:00
82xx powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
83xx powerpc/platforms/83xx: Use of_device_get_match_data() 2022-05-22 15:58:31 +10:00
85xx powerpc/85xx: Remove FSL_85XX_CACHE_SRAM 2022-05-22 15:58:30 +10:00
86xx powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
512x powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
amigaone powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
book3s powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
cell powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
chrp powerpc: Fix all occurences of "the the" 2022-05-22 15:59:43 +10:00
embedded6xx powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
maple powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
microwatt powerpc/microwatt: wire up rng during setup_arch() 2022-06-18 10:19:10 +10:00
pasemi powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
powermac powerpc/powermac: constify device_node in of_irq_parse_oldworld() 2022-05-22 15:59:54 +10:00
powernv powerpc/powernv: Avoid crashing if rng is NULL 2022-08-17 15:13:57 +02:00
ps3 powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
pseries powerpc/pseries: wire up rng during setup_arch() 2022-06-18 10:19:10 +10:00
Kconfig powerpc: Rename PPC_NATIVE to PPC_HASH_MMU_NATIVE 2021-12-02 22:57:22 +11:00
Kconfig.cputype powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
Makefile powerpc: Add Microwatt platform 2021-06-21 21:15:26 +10:00
fsl_uli1575.c powerpc: Add missing headers 2022-05-08 22:15:40 +10:00