From 3a8ad050aa8b1663316952d1d4bebdb5f4911160 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Mon, 12 Aug 2024 23:57:59 +0300 Subject: efi_loader: fix memory freeing in efi_get_dp_from_boot() efi_get_var() allocates memory which must be freed after the variable is used. Since the device path is duplicated after we deserialize the load options free the memory used for the variable payload Fixes: db61e70e0d2a efi_loader: efi_dp_from_lo() should skip VenMedia node Signed-off-by: Ilias Apalodimas Reviewed-by: Heinric Schuchardt --- lib/efi_loader/efi_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 65d2116381a..916f43da26c 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -74,6 +74,7 @@ out: */ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid) { + struct efi_device_path *file_path = NULL; struct efi_load_option lo; void *var_value; efi_uintn_t size; @@ -92,11 +93,11 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid) if (ret != EFI_SUCCESS) goto err; - return efi_dp_from_lo(&lo, guid); + file_path = efi_dp_from_lo(&lo, guid); err: free(var_value); - return NULL; + return file_path; } /** -- cgit v1.3.1 From dcd1b63b7072749f98ea0a87565d0ae5c8ddfb65 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 21 Aug 2024 23:33:49 +0200 Subject: efi_loader: allow EFI_LOADER_BOUNCE_BUFFER on all architectures There not only ARM64 boards but also RISC-V boards that require a bounce buffer to read block devices. Drop the architecture restriction. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 1179c31bb13..6ffefa9103f 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -364,7 +364,6 @@ endif config EFI_LOADER_BOUNCE_BUFFER bool "EFI Applications use bounce buffers for DMA operations" - depends on ARM64 help Some hardware does not support DMA to full 64bit addresses. For this hardware we can create a bounce buffer so that payloads don't have to -- cgit v1.3.1