diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2021-07-26 09:38:28 +0200 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-09-14 11:19:58 -0400 |
| commit | 50732ee914f23df541c77ffd83c3c1921249130d (patch) | |
| tree | bab8e76547e133bf889b8ebdde01fff6fa420c90 /shim.c | |
| parent | 11740ea761ac5a1eb84c865edbdcd750f2a8b04f (diff) | |
| download | efi-boot-shim-50732ee914f23df541c77ffd83c3c1921249130d.tar.gz efi-boot-shim-50732ee914f23df541c77ffd83c3c1921249130d.zip | |
Fallback to default loader if parsed one does not exist
If the specified second stage loader does not exist (invalid
parameter), fall back to the DEFAULT_LOADER. This avoids failing
the boot on any garbage that made it through the load option parser
as a second stage loader name.
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1937115
Diffstat (limited to 'shim.c')
| -rw-r--r-- | shim.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1116,6 +1116,19 @@ EFI_STATUS init_grub(EFI_HANDLE image_handle) use_fb ? FALLBACK : second_stage); } + // If the filename is invalid, or the file does not exist, + // just fallback to the default loader. + if (!use_fb && (efi_status == EFI_INVALID_PARAMETER || + efi_status == EFI_NOT_FOUND)) { + console_print( + L"start_image() returned %r, falling back to default loader\n", + efi_status); + msleep(2000000); + load_options = NULL; + load_options_size = 0; + efi_status = start_image(image_handle, DEFAULT_LOADER); + } + if (EFI_ERROR(efi_status)) { console_print(L"start_image() returned %r\n", efi_status); msleep(2000000); |
