linux-stable/drivers/firmware/efi
Hagar Hemdan b8938d6f57 efi: libstub: only free priv.runtime_map when allocated
commit 4b2543f7e1 upstream.

priv.runtime_map is only allocated when efi_novamap is not set.
Otherwise, it is an uninitialized value.  In the error path, it is freed
unconditionally.  Avoid passing an uninitialized value to free_pool.
Free priv.runtime_map only when it was allocated.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Fixes: f80d26043a ("efi: libstub: avoid efi_get_memory_map() for allocating the virt map")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-12 11:03:01 +02:00
..
libstub efi: libstub: only free priv.runtime_map when allocated 2024-06-12 11:03:01 +02:00
test
apple-properties.c
arm-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-03-01 13:26:29 +01:00
capsule-loader.c efi/capsule-loader: fix incorrect allocation size 2024-03-06 14:45:09 +00:00
capsule.c
cper-arm.c
cper-x86.c
cper.c
dev-path-parser.c
earlycon.c
efi-bgrt.c
efi-init.c efi: Don't add memblocks for soft-reserved memory 2024-03-01 13:26:29 +01:00
efi-pstore.c
efi.c efi: fix panic in kdump kernel 2024-04-03 15:19:45 +02:00
efibc.c
embedded-firmware.c
esrt.c
fake_mem.c
fake_mem.h
fdtparams.c
Kconfig
Makefile
memattr.c
memmap.c
mokvar-table.c
rci2-table.c
reboot.c
riscv-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-03-01 13:26:29 +01:00
runtime-map.c
runtime-wrappers.c
sysfb_efi.c
tpm.c
vars.c efi: efivars: prevent double registration 2024-03-06 14:45:17 +00:00
x86_fake_mem.c