linux-stable/drivers/firmware/efi
Anton Gusev 966d47e1f2 efi: fix potential NULL deref in efi_mem_reserve_persistent
When iterating on a linked list, a result of memremap is dereferenced
without checking it for NULL.

This patch adds a check that falls back on allocating a new page in
case memremap doesn't succeed.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 18df7577ad ("efi/memreserve: deal with memreserve entries in unmapped memory")
Signed-off-by: Anton Gusev <aagusev@ispras.ru>
[ardb: return -ENOMEM instead of breaking out of the loop]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2023-02-03 14:52:10 +01:00
..
libstub - Do some spring cleaning to the compressed boot code by moving the 2022-12-13 14:45:29 -08:00
test efi/efi_test: read RuntimeServicesSupported 2020-12-09 08:37:27 +01:00
apple-properties.c efi: fix return value of __setup handlers 2022-03-01 09:02:21 +01:00
arm-runtime.c ARM updates for 6.2 2022-12-13 15:22:14 -08:00
capsule-loader.c efi: capsule-loader: Fix use-after-free in efi_capsule_write 2022-09-07 18:23:56 +02:00
capsule.c efi: capsule: clean scatter-gather entries from the D-cache 2020-12-09 08:37:27 +01:00
cper-arm.c
cper-x86.c x86/mce, cper: Pass x86 CPER through the MCA handling chain 2020-11-21 12:05:41 +01:00
cper.c EFI updates for v6.2: 2022-12-13 14:31:47 -08:00
cper_cxl.c efi/cper, cxl: Decode CXL Error Log 2022-11-18 09:14:10 +01:00
cper_cxl.h efi/cper, cxl: Decode CXL Protocol Error Section 2022-11-18 09:14:10 +01:00
dev-path-parser.c efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer() 2022-09-19 18:34:42 +02:00
earlycon.c efi: earlycon: use console_is_registered() 2022-12-02 11:25:01 +01:00
efi-bgrt.c
efi-init.c efi: libstub: Move screen_info handling to common code 2022-11-09 12:42:02 +01:00
efi-pstore.c EFI updates for v6.2: 2022-12-13 14:31:47 -08:00
efi.c efi: fix potential NULL deref in efi_mem_reserve_persistent 2023-02-03 14:52:10 +01:00
efibc.c efi: efibc: Guard against allocation failure 2022-09-20 18:42:55 +02:00
embedded-firmware.c crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
esrt.c efi: use default_groups in kobj_type 2022-01-06 21:19:05 +01:00
fdtparams.c efi: xen: Set EFI_PARAVIRT for Xen dom0 boot on all architectures 2022-11-18 09:14:09 +01:00
Kconfig efi: libstub: Always enable initrd command line loader and bump version 2022-12-01 16:08:18 +01:00
Makefile efi/cper, cxl: Decode CXL Protocol Error Section 2022-11-18 09:14:10 +01:00
memattr.c efi: Accept version 2 of memory attributes table 2023-02-02 18:32:25 +01:00
memmap.c efi: xen: Set EFI_PARAVIRT for Xen dom0 boot on all architectures 2022-11-18 09:14:09 +01:00
mokvar-table.c efi/mokvar: move up init order 2022-03-08 13:55:52 +02:00
rci2-table.c
reboot.c efi: Fix efi_power_off() not being run before acpi_power_off() when necessary 2022-07-10 17:41:06 +02:00
riscv-runtime.c efi: runtime: Don't assume virtual mappings are missing if VA == PA == 0 2022-10-21 11:09:41 +02:00
runtime-wrappers.c efi: fix userspace infinite retry read efivars after EFI runtime services page fault 2023-01-03 10:52:16 +01:00
sysfb_efi.c efi: sysfb_efi: remove unnecessary <asm/efi.h> include 2022-06-21 18:11:43 +02:00
tpm.c efi/tpm: Pass correct address to memblock_reserve 2022-10-24 08:04:25 +02:00
vars.c efi: efivars: Fix variable writes with unsupported query_variable_store() 2022-10-28 18:26:30 +02:00