This is a note to let you know that I've just added the patch titled efivars: respect EFI_UNSUPPORTED return from firmware to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: efivars-respect-efi_unsupported-return-from-firmware.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 483028edacab374060d93955382b4865a9e07cba Mon Sep 17 00:00:00 2001 From: Shawn Guo <shawn.guo@xxxxxxxxxx> Date: Wed, 17 Mar 2021 14:36:06 +0800 Subject: efivars: respect EFI_UNSUPPORTED return from firmware From: Shawn Guo <shawn.guo@xxxxxxxxxx> commit 483028edacab374060d93955382b4865a9e07cba upstream. As per UEFI spec 2.8B section 8.2, EFI_UNSUPPORTED may be returned by EFI variable runtime services if no variable storage is supported by firmware. In this case, there is no point for kernel to continue efivars initialization. That said, efivar_init() should fail by returning an error code, so that efivarfs will not be mounted on /sys/firmware/efi/efivars at all. Otherwise, user space like efibootmgr will be confused by the EFIVARFS_MAGIC seen there, while EFI variable calls cannot be made successfully. Cc: <stable@xxxxxxxxxxxxxxx> # v5.10+ Signed-off-by: Shawn Guo <shawn.guo@xxxxxxxxxx> Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/firmware/efi/vars.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -485,6 +485,10 @@ int efivar_init(int (*func)(efi_char16_t } break; + case EFI_UNSUPPORTED: + err = -EOPNOTSUPP; + status = EFI_NOT_FOUND; + break; case EFI_NOT_FOUND: break; default: Patches currently in stable-queue which might be from shawn.guo@xxxxxxxxxx are queue-5.10/efivars-respect-efi_unsupported-return-from-firmware.patch