linux/drivers/firmware/efi
Jan Kiszka 77ff27ff0e efi: stmm: Fix incorrect buffer allocation method
[ Upstream commit c5e81e6726 ]

The communication buffer allocated by setup_mm_hdr() is later on passed
to tee_shm_register_kernel_buf(). The latter expects those buffers to be
contiguous pages, but setup_mm_hdr() just uses kmalloc(). That can cause
various corruptions or BUGs, specifically since commit 9aec2fb0fd
("slab: allocate frozen pages"), though it was broken before as well.

Fix this by using alloc_pages_exact() instead of kmalloc().

Fixes: c44b6be62e ("efi: Add tee-based EFI variable driver")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-09-04 15:31:48 +02:00
..
libstub efi/libstub: Describe missing 'out' parameter in efi_load_initrd 2025-06-19 15:31:48 +02:00
stmm efi: stmm: Fix incorrect buffer allocation method 2025-09-04 15:31:48 +02:00
test [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
apple-properties.c efi: fix return value of __setup handlers 2022-03-01 09:02:21 +01:00
arm-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-02-02 19:31:24 +01:00
capsule-loader.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
capsule.c efi: capsule: clean scatter-gather entries from the D-cache 2020-12-09 08:37:27 +01:00
cper-arm.c efi/cper: Remove unnecessary aer.h include 2023-04-07 16:42:31 -05:00
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/cper: Print correctable AER information 2024-08-27 12:23:19 +02:00
cper_cxl.c efi/cper, cxl: Remove cxl_err.h 2023-02-03 23:59:58 +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: use acpi_dev_uid_match() for matching _UID 2023-12-06 18:02:37 +01:00
earlycon.c fbcon: Increase maximum font width x height to 64 x 128 2024-03-16 08:29:48 +01:00
efi-bgrt.c efi/bgrt: Accept BGRT tables with a version of 0 2020-02-22 23:37:37 +01:00
efi-init.c efi: Don't add memblocks for soft-reserved memory 2024-02-02 19:31:24 +01:00
efi-pstore.c efi: pstore: Return proper errors on UEFI failures 2024-05-23 09:09:39 +02:00
efi.c efi: Avoid cold plugged memory for placing the kernel 2025-02-21 14:01:34 +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/esrt: Allow ESRT access without CAP_SYS_ADMIN 2023-06-06 15:33:59 +02:00
fdtparams.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
Kconfig efi/zboot: Limit compression options to GZIP and ZSTD 2025-01-23 17:22:47 +01:00
Makefile efi: Add tee-based EFI variable driver 2023-12-11 11:19:18 +01:00
memattr.c efi: Replace efi_memory_attributes_table_t 0-sized array with flexible array 2024-07-12 10:06:01 +02:00
memmap.c efi/x86: Free EFI memory map only when installing a new one. 2024-06-15 10:25:02 +02:00
mokvar-table.c efi: Don't map the entire mokvar table to determine its size 2025-03-07 18:25:45 +01:00
rci2-table.c treewide: Use sysfs_bin_attr_simple_read() helper 2024-04-11 16:02:25 +02:00
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 riscv: dmi: Add SMBIOS/DMI support 2024-06-26 08:02:33 -07:00
runtime-wrappers.c efi: Add missing __nocfi annotations to runtime wrappers 2024-06-05 10:18:58 +02:00
sysfb_efi.c efi: sysfb_efi: fix W=1 warnings when EFI is not set 2025-02-08 09:57:51 +01:00
tpm.c tpm: fix signed/unsigned bug when checking event logs 2024-12-05 14:01:27 +01:00
unaccepted_memory.c mm: rework accept memory helpers 2024-09-01 20:26:07 -07:00
vars.c efi: Clear up misconceptions about a maximum variable name size 2024-04-13 10:33:02 +02:00