diff options
| author | Gary Lin <glin@suse.com> | 2021-05-05 11:25:07 +0800 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-07-20 10:13:31 -0400 |
| commit | 3f327f546c219634b24cfd9abe9ec987bbb6ad14 (patch) | |
| tree | f7cae7aa78e94cff7a6b88003d597ce5a2b0baf9 | |
| parent | 7501b6bb449f6e4d13e700a65650f9308f54c8c1 (diff) | |
| download | efi-boot-shim-3f327f546c219634b24cfd9abe9ec987bbb6ad14.tar.gz efi-boot-shim-3f327f546c219634b24cfd9abe9ec987bbb6ad14.zip | |
mok: relax the maximum variable size check
Some UEFI environment such as u-boot doesn't implement
QueryVariableInfo(), so we couldn't rely on the function to estimate the
available space for RT variables. All we can do is to call SetVariable()
directly and check the return value of SetVariable().
Signed-off-by: Gary Lin <glin@suse.com>
| -rw-r--r-- | mok.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -364,13 +364,18 @@ mirror_mok_db(CHAR16 *name, CHAR8 *name8, EFI_GUID *guid, UINT32 attrs, SIZE_T max_var_sz; efi_status = get_max_var_sz(attrs, &max_var_sz); - if (EFI_ERROR(efi_status)) { + if (EFI_ERROR(efi_status) && efi_status != EFI_UNSUPPORTED) { LogError(L"Could not get maximum variable size: %r", efi_status); return efi_status; } - if (FullDataSize <= max_var_sz) { + /* Some UEFI environment such as u-boot doesn't implement + * QueryVariableInfo() and we will only get EFI_UNSUPPORTED when + * querying the available space. In this case, we just mirror + * the variable directly. */ + if (FullDataSize <= max_var_sz || efi_status == EFI_UNSUPPORTED) { + efi_status = EFI_SUCCESS; if (only_first) efi_status = SetVariable(name, guid, attrs, FullDataSize, FullData); |
