kernel_samsung_a53x/drivers/firmware
Ard Biesheuvel 2aa6501b2f efi/x86: Free EFI memory map only when installing a new one.
[ Commit 75dde792d6f6c2d0af50278bd374bf0c512fe196 upstream ]

The logic in __efi_memmap_init() is shared between two different
execution flows:
- mapping the EFI memory map early or late into the kernel VA space, so
  that its entries can be accessed;
- the x86 specific cloning of the EFI memory map in order to insert new
  entries that are created as a result of making a memory reservation
  via a call to efi_mem_reserve().

In the former case, the underlying memory containing the kernel's view
of the EFI memory map (which may be heavily modified by the kernel
itself on x86) is not modified at all, and the only thing that changes
is the virtual mapping of this memory, which is different between early
and late boot.

In the latter case, an entirely new allocation is created that carries a
new, updated version of the kernel's view of the EFI memory map. When
installing this new version, the old version will no longer be
referenced, and if the memory was allocated by the kernel, it will leak
unless it gets freed.

The logic that implements this freeing currently lives on the code path
that is shared between these two use cases, but it should only apply to
the latter. So move it to the correct spot.

While at it, drop the dummy definition for non-x86 architectures, as
that is no longer needed.

Cc: <stable@vger.kernel.org>
Fixes: f0ef6523475f ("efi: Fix efi_memmap_alloc() leaks")
Tested-by: Ashish Kalra <Ashish.Kalra@amd.com>
Link: https://lore.kernel.org/all/36ad5079-4326-45ed-85f6-928ff76483d3@amd.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-19 14:19:35 +01:00
..
arm_scmi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
broadcom Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
efi efi/x86: Free EFI memory map only when installing a new one. 2024-11-19 14:19:35 +01:00
google Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
meson firmware: meson_sm: populate platform devices from sm device tree data 2024-11-18 12:12:28 +01:00
psci Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smccc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tegra Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xilinx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arm_scpi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arm_sdei.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dmi-id.c firmware: dmi-id: add a release callback function 2024-11-19 12:27:01 +01:00
dmi-sysfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dmi_scan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
edd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iscsi_ibft.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iscsi_ibft_find.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
memmap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pcdp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pcdp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qcom_scm-legacy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qcom_scm-smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qcom_scm.c firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit 2024-11-18 11:43:25 +01:00
qcom_scm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qemu_fw_cfg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raspberrypi.c firmware: raspberrypi: Use correct device for DMA mappings 2024-11-19 12:26:52 +01:00
scpi_pm_domain.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stratix10-rsu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stratix10-svc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ti_sci.c firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create() 2024-11-18 12:12:28 +01:00
ti_sci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trusted_foundations.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
turris-mox-rwtm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00