Commit 0575b04a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] efivars: check that it's enabled

From: "Randy.Dunlap" <rddunlap@osdl.org>

EFI-enabled kernels crash on non-EFI machines.  efivars_init() and
efivars_exit() need to check efi_enabled instead of assuming that the
system is using EFI.
parent 8f1ee1b3
...@@ -65,6 +65,7 @@ static inline char * __init machine_specific_memory_setup(void); ...@@ -65,6 +65,7 @@ static inline char * __init machine_specific_memory_setup(void);
#ifdef CONFIG_EFI #ifdef CONFIG_EFI
int efi_enabled = 0; int efi_enabled = 0;
EXPORT_SYMBOL(efi_enabled);
#endif #endif
/* cpu data as detected by the assembly code in head.S */ /* cpu data as detected by the assembly code in head.S */
......
...@@ -664,6 +664,9 @@ efivars_init(void) ...@@ -664,6 +664,9 @@ efivars_init(void)
unsigned long variable_name_size = 1024; unsigned long variable_name_size = 1024;
int i, rc = 0, error = 0; int i, rc = 0, error = 0;
if (!efi_enabled)
return -ENODEV;
printk(KERN_INFO "EFI Variables Facility v%s\n", EFIVARS_VERSION); printk(KERN_INFO "EFI Variables Facility v%s\n", EFIVARS_VERSION);
/* /*
...@@ -733,6 +736,9 @@ efivars_exit(void) ...@@ -733,6 +736,9 @@ efivars_exit(void)
{ {
struct list_head *pos, *n; struct list_head *pos, *n;
if (!efi_enabled)
return;
list_for_each_safe(pos, n, &efivar_list) list_for_each_safe(pos, n, &efivar_list)
efivar_unregister(get_efivar_entry(pos)); efivar_unregister(get_efivar_entry(pos));
......
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