aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/efivars.c
diff options
context:
space:
mode:
authorMatt Fleming2013-07-11 07:30:33 +0100
committerMatt Fleming2013-07-11 11:00:31 +0100
commitd320c079efd46db1be0640d00bd6723d9e738f9f (patch)
treea7569a0740d894e36e845971f9de35c3d9363b3c /drivers/firmware/efi/efivars.c
parent6d128e1e72bf082542e85f72e6b7ddd704193588 (diff)
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: Dave Young <dyoung@redhat.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'drivers/firmware/efi/efivars.c')
-rw-r--r--drivers/firmware/efi/efivars.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index 8bd1bb6dbe47..8a7432a4b413 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -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;