Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3
+3
drivers/firmware/efi/efivars.c
··· 583 583 struct kobject *parent_kobj = efivars_kobject(); 584 584 int error = 0; 585 585 586 + if (!efi_enabled(EFI_RUNTIME_SERVICES)) 587 + return -ENODEV; 588 + 586 589 /* No efivars has been registered yet */ 587 590 if (!parent_kobj) 588 591 return 0;