Skip to content

Commit

Permalink
efivars: check for EFI_RUNTIME_SERVICES
Browse files Browse the repository at this point in the history
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: Dave Young <dyoung@redhat.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
  • Loading branch information
Matt Fleming committed Jul 11, 2013
1 parent 6d128e1 commit d320c07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/firmware/efi/efivars.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,9 @@ int efivars_sysfs_init(void)
struct kobject *parent_kobj = efivars_kobject();
int error = 0;

if (!efi_enabled(EFI_RUNTIME_SERVICES))
return -ENODEV;

/* No efivars has been registered yet */
if (!parent_kobj)
return 0;
Expand Down

0 comments on commit d320c07

Please sign in to comment.