linux-brain/drivers/firmware/efi
Ard Biesheuvel a2a380bcf4 efi/esrt: Only call efi_mem_reserve() for boot services memory
[ Upstream commit 61f0d55569 ]

The following commit:

  7e1550b8f2 ("efi: Drop type and attribute checks in efi_mem_desc_lookup()")

refactored the implementation of efi_mem_desc_lookup() so that the type
check is moved to the callers, one of which is the x86 version of
efi_arch_mem_reserve(), where we added a modified check that only takes
EFI_BOOT_SERVICES_DATA regions into account.

This is reasonable, since it is the only memory type that requires this,
but doing so uncovered some unexpected behavior in the ESRT code, which
permits the ESRT table to reside in other types of memory than what the
UEFI spec mandates (i.e., EFI_BOOT_SERVICES_DATA), and unconditionally
calls efi_mem_reserve() on the region in question. This may result in
errors such as

  esrt: Reserving ESRT space from 0x000000009c810318 to 0x000000009c810350.
  efi: Failed to lookup EFI memory descriptor for 0x000000009c810318

when the ESRT table is not in EFI_BOOT_SERVICES_DATA memory, but we try
to reserve it nonetheless.

So make the call to efi_mem_reserve() conditional on the memory type.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Jones <pjones@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:36:38 +02:00
..
libstub efi/libstub: Skip GOP with PIXEL_BLT_ONLY format 2017-04-21 09:31:20 +02:00
test efi: Add efi_test driver for exporting UEFI runtime service interfaces 2016-09-09 16:08:53 +01:00
Kconfig efi: Add efi_test driver for exporting UEFI runtime service interfaces 2016-09-09 16:08:53 +01:00
Makefile efi: Add efi_test driver for exporting UEFI runtime service interfaces 2016-09-09 16:08:53 +01:00
arm-init.c efi/arm: preserve early mapping of UEFI memory map longer for BGRT 2018-09-26 08:36:33 +02:00
arm-runtime.c efi/arm: preserve early mapping of UEFI memory map longer for BGRT 2018-09-26 08:36:33 +02:00
capsule-loader.c efi/capsule: Allocate whole capsule into virtual memory 2016-08-11 13:55:36 +02:00
capsule.c efi/capsule: Allocate whole capsule into virtual memory 2016-08-11 13:55:36 +02:00
cper.c efi: Handle memory error structures produced based on old versions of standard 2015-07-15 13:30:38 +01:00
efi-pstore.c Fix bug in module unloading. 2016-10-06 15:16:16 -07:00
efi.c efi/esrt: Cleanup bad memory map log messages 2017-12-20 10:07:26 +01:00
efibc.c efibc: Report more information in the error messages 2016-06-27 13:06:54 +02:00
efivars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00
esrt.c efi/esrt: Only call efi_mem_reserve() for boot services memory 2018-09-26 08:36:38 +02:00
fake_mem.c x86/efi: Don't allocate memmap through memblock after mm_init() 2017-01-19 20:18:00 +01:00
memattr.c efi: Implement generic support for the Memory Attributes table 2016-04-28 11:33:54 +02:00
memmap.c x86/efi: Don't allocate memmap through memblock after mm_init() 2017-01-19 20:18:00 +01:00
reboot.c efi: Add 'capsule' update support 2016-04-28 11:34:03 +02:00
runtime-map.c efi: Move some sysfs files to be read-only by root 2017-12-14 09:28:11 +01:00
runtime-wrappers.c efi: Replace runtime services spinlock with semaphore 2016-09-09 16:08:43 +01:00
vars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00