History

efi: efivars: Fix variable writes without query_variable_store()

Commit bbc6d2c6ef22 ("efi: vars: Switch to new wrapper layer") refactored the efivars layer so that the 'business logic' related to which UEFI variables affect the boot flow in which way could be moved out of it, and into the efivarfs driver. This inadvertently broke setting variables on firmware implementations that lack the QueryVariableInfo() boot service, because we no longer tolerate a EFI_UNSUPPORTED result from check_var_size() when calling efivar_entry_set_get_size(), which now ends up calling check_var_size() a second time inadvertently. If QueryVariableInfo() is missing, we support writes of up to 64k - let's move that logic into check_var_size(), and drop the redundant call.

Ard Biesheuvel committed 4 years ago

Commit 8a254d91 parent 4b017e53 files · +5 −24Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/efi.h+0−3
@@ -1085,9 +1085,6 @@ efi_status_t efivar_set_variable_locked(efi_char16_t *name, efi_guid_t *vendor, · 1084 unmodified lines
1085efi_status_t efivar_set_variable(efi_char16_t *name, efi_guid_t *vendor,1085efi_status_t efivar_set_variable(efi_char16_t *name, efi_guid_t *vendor,
1086 u32 attr, unsigned long data_size, void *data);1086 u32 attr, unsigned long data_size, void *data);
1087 1087
1088efi_status_t check_var_size(u32 attributes, unsigned long size);
1089efi_status_t check_var_size_nonblocking(u32 attributes, unsigned long size);
1090
1091#if IS_ENABLED(CONFIG_EFI_CAPSULE_LOADER)1088#if IS_ENABLED(CONFIG_EFI_CAPSULE_LOADER)
1092extern bool efi_capsule_pending(int *reset_type);1089extern bool efi_capsule_pending(int *reset_type);
1093 1090