Commit d320c079 authored by Matt Fleming's avatar Matt Fleming

efivars: check for EFI_RUNTIME_SERVICES

The efivars code requires EFI runtime services to function, so check
that they are enabled.

This fixes a crash when booting with the "noefi" kernel parameter, and
also when mixing kernel and firmware "bitness", e.g. 32-bit kernel with
64-bit firmware.
Tested-by: default avatarDave Young <dyoung@redhat.com>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent 6d128e1e
...@@ -583,6 +583,9 @@ int efivars_sysfs_init(void) ...@@ -583,6 +583,9 @@ int efivars_sysfs_init(void)
struct kobject *parent_kobj = efivars_kobject(); struct kobject *parent_kobj = efivars_kobject();
int error = 0; int error = 0;
if (!efi_enabled(EFI_RUNTIME_SERVICES))
return -ENODEV;
/* No efivars has been registered yet */ /* No efivars has been registered yet */
if (!parent_kobj) if (!parent_kobj)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment