diff options
author | Heinrich Schuchardt | 2024-04-22 11:03:10 +0200 |
---|---|---|
committer | Heinrich Schuchardt | 2024-05-01 07:39:00 +0200 |
commit | 2c4ca2d672f7a64e50dc543eb4e9f076666a417d (patch) | |
tree | 78078475f47db76c75f9847d08fdd28315e844d9 | |
parent | 566f067349a8f6136cf62d907019efdf1e250ce5 (diff) |
efi_loader: do not install dtb if bootmgr fails
If the UEFI boot manager fails there is no point in installing the
device-tree as a configuration table.
Unload image if device-tree cannot be installed.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r-- | lib/efi_loader/efi_bootmgr.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index ca2ebdaa32f..7da3139f917 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -1209,15 +1209,21 @@ efi_status_t efi_bootmgr_run(void *fdt) return CMD_RET_FAILURE; } - ret = efi_install_fdt(fdt); - if (ret != EFI_SUCCESS) - return ret; - ret = efi_bootmgr_load(&handle, &load_options); if (ret != EFI_SUCCESS) { log_notice("EFI boot manager: Cannot load any image\n"); return ret; } + ret = efi_install_fdt(fdt); + if (ret != EFI_SUCCESS) { + if (EFI_CALL(efi_unload_image(handle)) == EFI_SUCCESS) + free(load_options); + else + log_err("Unloading image failed\n"); + + return ret; + } + return do_bootefi_exec(handle, load_options); } |