efi: verify that variable services are supported
authorJohan Hovold <johan+linaro@kernel.org>
Thu, 19 Jan 2023 16:42:54 +0000 (17:42 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Thu, 26 Jan 2023 20:32:01 +0000 (21:32 +0100)
commitbad267f9e18f8e9e628abd1811d2899b1735a4e1
tree872ac0fff8fa9f2c0bb6165fe3e5f12af381e872
parent301de9a2055357375a4e1053d9df0f8f3467ff00
efi: verify that variable services are supported

Current Qualcomm UEFI firmware does not implement the variable services
but not all revisions clear the corresponding bits in the RT_PROP table
services mask and instead the corresponding calls return
EFI_UNSUPPORTED.

This leads to efi core registering the generic efivar ops even when the
variable services are not supported or when they are accessed through
some other interface (e.g. Google SMI or the upcoming Qualcomm SCM
implementation).

Instead of playing games with init call levels to make sure that the
custom implementations are registered after the generic one, make sure
that get_next_variable() is actually supported before registering the
generic ops.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/efi.c