aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/virt
diff options
context:
space:
mode:
authorGravatar Ard Biesheuvel <ardb@kernel.org> 2024-06-10 16:02:13 +0200
committerGravatar Ard Biesheuvel <ardb@kernel.org> 2024-06-15 10:25:02 +0200
commit75dde792d6f6c2d0af50278bd374bf0c512fe196 (patch)
tree73e080ccb417f8c4d389c27d95daf92376fbe2c7 /arch/x86/virt
parentefi/arm: Disable LPAE PAN when calling EFI runtime services (diff)
downloadlinux-75dde792d6f6c2d0af50278bd374bf0c512fe196.tar.gz
linux-75dde792d6f6c2d0af50278bd374bf0c512fe196.tar.bz2
linux-75dde792d6f6c2d0af50278bd374bf0c512fe196.zip
efi/x86: Free EFI memory map only when installing a new one.
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>
Diffstat (limited to 'arch/x86/virt')
0 files changed, 0 insertions, 0 deletions