linux/drivers/firmware/efi
Jeffrey Hugo b4bcdf6887 efi/libstub: Allocate headspace in efi_get_memory_map()
commit dadb57abc3 upstream.

efi_get_memory_map() allocates a buffer to store the memory map that it
retrieves.  This buffer may need to be reused by the client after
ExitBootServices() is called, at which point allocations are not longer
permitted.  To support this usecase, provide the allocated buffer size back
to the client, and allocate some additional headroom to account for any
reasonable growth in the map that is likely to happen between the call to
efi_get_memory_map() and the client reusing the buffer.

Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
[bwh: Backported to 3.16:
 - Adjust filenames, context
 - In allocate_new_fdt_and_exit_boot(), only fill memory_map
 - Drop changes to efi_random_alloc()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2016-11-20 01:17:23 +00:00
..
arm-stub.c efi/arm64: ignore dtb= when UEFI SecureBoot is enabled 2014-04-30 19:57:06 +01:00
cper.c Move cper.c from drivers/acpi/apei to drivers/firmware/efi 2013-10-31 11:27:04 -07:00
efi-pstore.c efi-pstore: Fix an overflow on 32-bit builds 2014-06-27 07:30:32 +01:00
efi-stub-helper.c efi/libstub: Allocate headspace in efi_get_memory_map() 2016-11-20 01:17:23 +00:00
efi.c sysfs: Create mountpoints with sysfs_create_mount_point 2015-08-20 18:24:03 +01:00
efivars.c efi: Make our variable validation list include the guid 2016-03-24 10:01:19 +00:00
fdt.c efi/libstub: Allocate headspace in efi_get_memory_map() 2016-11-20 01:17:23 +00:00
Kconfig efi: add helper function to get UEFI params from FDT 2014-04-30 19:49:46 +01:00
Makefile efi/reboot: Add generic wrapper around EfiResetSystem() 2015-05-12 09:36:34 +01:00
reboot.c x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag 2015-05-12 09:36:34 +01:00
runtime-map.c efi: Fix error handling in add_sysfs_runtime_map_entry() 2015-05-20 13:26:05 +01:00
vars.c efi: Fix out-of-bounds read in variable_matches() 2016-06-15 21:29:26 +01:00