]> git.baikalelectronics.ru Git - kernel.git/commit
efi: efivars: Fix variable writes without query_variable_store()
authorArd Biesheuvel <ardb@kernel.org>
Wed, 19 Oct 2022 21:29:58 +0000 (23:29 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 21 Oct 2022 09:09:40 +0000 (11:09 +0200)
commit633ebaf46b8427720c06291da1c73d52c9b8ce0c
tree070e9b3229edbf81b724c919be3e0d8b10e79ca2
parent4d662f8458563edb698c4d1410c58bd59bb44291
efi: efivars: Fix variable writes without query_variable_store()

Commit 685c192d1fc9 ("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.

Cc: <stable@vger.kernel.org> # v6.0
Fixes: 685c192d1fc9 ("efi: vars: Switch to new wrapper layer")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/vars.c
fs/efivarfs/vars.c
include/linux/efi.h