linux-stable/arch/powerpc
Xiaomeng Tong 427672659a KVM: PPC: Book3S HV: fix incorrect NULL check on list iterator
commit 300981abdd upstream.

The bug is here:
	if (!p)
                return ret;

The list iterator value 'p' will *always* be set and non-NULL by
list_for_each_entry(), so it is incorrect to assume that the iterator
value will be NULL if the list is empty or no element is found.

To fix the bug, Use a new value 'iter' as the list iterator, while use
the old value 'p' as a dedicated variable to point to the found element.

Fixes: dfaa973ae9 ("KVM: PPC: Book3S HV: In H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs")
Cc: stable@vger.kernel.org # v5.9+
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220414062103.8153-1-xiam0nd.tong@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06 08:47:52 +02:00
..
boot powerpc: dts: t104xrdb: fix phy type for FMAN 4/5 2022-04-13 19:27:10 +02:00
configs RTC for 5.17 2022-01-21 13:13:35 +02:00
crypto powerpc updates for 5.17 2022-01-14 15:17:26 +01:00
include powerpc: define get_cycles macro for arch-override 2022-05-30 09:27:13 +02:00
kernel powerpc/64: Add UADDR64 relocation support 2022-05-09 09:16:33 +02:00
kexec powerpc: Set crashkernel offset to mid of RMA region 2022-04-13 19:27:12 +02:00
kvm KVM: PPC: Book3S HV: fix incorrect NULL check on list iterator 2022-06-06 08:47:52 +02:00
lib powerpc/code-patching: Pre-map patch area 2022-04-13 19:27:20 +02:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm Revert "powerpc: Set max_mapnr correctly" 2022-04-13 19:27:41 +02:00
net powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 2022-01-15 12:21:25 +11:00
perf powerpc/perf: Fix 32bit compile 2022-05-09 09:16:28 +02:00
platforms powerpc/64e: Tie PPC_BOOK3E_64 to PPC_FSL_BOOK3E 2022-04-13 19:27:20 +02:00
purgatory powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S 2021-04-08 21:17:43 +10:00
sysdev powerpc/xive: Export XIVE IPI information for online-only processors. 2022-04-13 19:27:10 +02:00
tools powerpc/64: Add UADDR64 relocation support 2022-05-09 09:16:33 +02:00
xmon powerpc/xmon: Dump XIVE information for online-only processors. 2022-01-06 21:47:00 +11:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig Merge branch 'akpm' (patches from Andrew) 2022-01-20 10:41:01 +02:00
Kconfig.debug powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP 2021-08-25 13:35:48 +10:00
Makefile powerpc/Makefile: Don't pass -mcpu=powerpc64 when building 32-bit 2022-04-08 13:58:14 +02:00
Makefile.postlink