aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-07-11 07:30:33 +0100
committerMark Brown <broonie@linaro.org>2014-06-16 21:14:54 +0100
commitb082f48205a0c8f3294f7de0852ac379a76fdc08 (patch)
treea97d8119a1ff8e4828402a5cf755e56c30b39a0d
parentbb0145e4e0e6f8112464975795850b3ce00c24f7 (diff)
downloadlinux-linaro-stable-b082f48205a0c8f3294f7de0852ac379a76fdc08.tar.gz
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> (cherry picked from commit d320c079efd46db1be0640d00bd6723d9e738f9f) Signed-off-by: Mark Brown <broonie@linaro.org>
-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;