stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: efi/urgent] efivars: respect EFI_UNSUPPORTED return from firmware
@ 2021-03-19 13:29 tip-bot2 for Shawn Guo
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Shawn Guo @ 2021-03-19 13:29 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: stable, Shawn Guo, Ard Biesheuvel, x86, linux-kernel

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     483028edacab374060d93955382b4865a9e07cba
Gitweb:        https://git.kernel.org/tip/483028edacab374060d93955382b4865a9e07cba
Author:        Shawn Guo <shawn.guo@linaro.org>
AuthorDate:    Wed, 17 Mar 2021 14:36:06 +08:00
Committer:     Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Wed, 17 Mar 2021 09:40:24 +01:00

efivars: respect EFI_UNSUPPORTED return from firmware

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@vger.kernel.org> # v5.10+
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/vars.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 41c1d00..abdc8a6 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -485,6 +485,10 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
 			}
 
 			break;
+		case EFI_UNSUPPORTED:
+			err = -EOPNOTSUPP;
+			status = EFI_NOT_FOUND;
+			break;
 		case EFI_NOT_FOUND:
 			break;
 		default:

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-19 13:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 13:29 [tip: efi/urgent] efivars: respect EFI_UNSUPPORTED return from firmware tip-bot2 for Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).