]> git.baikalelectronics.ru Git - kernel.git/commit
efi: efivars: Fix variable writes with unsupported query_variable_store()
authorArd Biesheuvel <ardb@kernel.org>
Thu, 27 Oct 2022 13:52:31 +0000 (15:52 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 28 Oct 2022 16:26:30 +0000 (18:26 +0200)
commit04f322713c027825520bb1723c3747b472baca9f
tree189713eaa80106d2ec0d7500a988495025d5eeaf
parent57c903be03590672e79b53ad55f73f5b75cea98a
efi: efivars: Fix variable writes with unsupported query_variable_store()

Commit 633ebaf46b84 ("efi: efivars: Fix variable writes without
query_variable_store()") addressed an issue that was introduced during
the EFI variable store refactor, where alternative implementations of
the efivars layer that lacked query_variable_store() would no longer
work.

Unfortunately, there is another case to consider here, which was missed:
if the efivars layer is backed by the EFI runtime services as usual, but
the EFI implementation predates the introduction of QueryVariableInfo(),
we will return EFI_UNSUPPORTED, and this is no longer being dealt with
correctly.

So let's fix this, and while at it, clean up the code a bit, by merging
the check_var_size() routines as well as their callers.

Cc: <stable@vger.kernel.org> # v6.0
Fixes: 685c192d1fc9 ("efi: vars: Switch to new wrapper layer")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Aditya Garg <gargaditya08@live.com>
drivers/firmware/efi/vars.c