]> Pileus Git - ~andy/linux/commitdiff
efivars: check for EFI_RUNTIME_SERVICES
authorMatt Fleming <matt.fleming@intel.com>
Thu, 11 Jul 2013 06:30:33 +0000 (07:30 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Thu, 11 Jul 2013 10:00:31 +0000 (11:00 +0100)
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>
drivers/firmware/efi/efivars.c

index 8bd1bb6dbe4739cf0914a129a12363c1bf157820..8a7432a4b4136807ad9a00015a00f5a249d6b112 100644 (file)
@@ -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;