Skip to content

Commit 483028e

Browse files
shawnguo2ardbiesheuvel
authored andcommitted
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: <[email protected]> # v5.10+ Signed-off-by: Shawn Guo <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 9e9888a commit 483028e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/firmware/efi/vars.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,10 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
484484
}
485485
}
486486

487+
break;
488+
case EFI_UNSUPPORTED:
489+
err = -EOPNOTSUPP;
490+
status = EFI_NOT_FOUND;
487491
break;
488492
case EFI_NOT_FOUND:
489493
break;

0 commit comments

Comments
 (0)