[PATCH] efi_loader: efi_disk_register() should not fail
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Sat Nov 20 14:08:49 CET 2021
Our algorithm for creating USB device paths may lead to duplicate device
paths which result in efi_disk_register() failing. Instead we should just
skip devices that cannot be registered as EFI block devices.
Fix a memory leak in efi_disk_add_dev() caused by the duplicate device
path.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
lib/efi_loader/efi_disk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index ef8b5c88ff..20121dea89 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -424,7 +424,7 @@ static efi_status_t efi_disk_add_dev(
&efi_block_io_guid, &diskobj->ops,
guid, NULL, NULL));
if (ret != EFI_SUCCESS)
- return ret;
+ return error;
/*
* On partitions or whole disks without partitions install the
@@ -573,7 +573,7 @@ efi_status_t efi_disk_register(void)
if (ret) {
log_err("ERROR: failure to add disk device %s, r = %lu\n",
dev->name, ret & ~EFI_ERROR_MASK);
- return ret;
+ continue;
}
disks++;
--
2.32.0
More information about the U-Boot
mailing list