summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichal Simek <[email protected]>2026-03-19 08:15:07 +0100
committerHeinrich Schuchardt <[email protected]>2026-04-17 07:40:17 +0200
commit57eae396ec91729d5655c26456f8ac3bac439202 (patch)
treef3d850421d9014a2b14141444d3b05b74bd2372b /lib
parent090a7eb9cf36aec08fbe131f0c475ccaa55a8241 (diff)
efi_loader: efi_var_sf: Do not fail on blank SPI Flash
When SPI Flash is blank (first boot or erased), efi_var_from_storage() returns EFI_DEVICE_ERROR because efi_var_restore() fails on invalid magic/CRC. This prevents the EFI subsystem from initializing. Check the magic value before attempting to restore variables. If the magic does not match EFI_VAR_FILE_MAGIC, treat it as an empty store and return EFI_SUCCESS, matching the behavior of the file-based efi_var_file.c which deliberately returns EFI_SUCCESS on missing or corrupted variable files to avoid blocking the boot process. Similarly, if the magic matches but efi_var_restore() fails (e.g. corrupted CRC), log the error but still return EFI_SUCCESS. Suggested-by: John Toomey <[email protected]> Signed-off-by: Michal Simek <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_var_sf.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/efi_loader/efi_var_sf.c b/lib/efi_loader/efi_var_sf.c
index 6eae8d46464..b84ec8e67dc 100644
--- a/lib/efi_loader/efi_var_sf.c
+++ b/lib/efi_loader/efi_var_sf.c
@@ -98,11 +98,8 @@ efi_status_t efi_var_from_storage(void)
goto error;
}
- if (efi_var_restore(buf, false) != EFI_SUCCESS) {
+ if (efi_var_restore(buf, false) != EFI_SUCCESS)
log_err("No valid EFI variables in SPI Flash\n");
- ret = EFI_DEVICE_ERROR;
- goto error;
- }
ret = EFI_SUCCESS;
error: