]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
efi/libstub: Allocate headspace in efi_get_memory_map()
authorJeffrey Hugo <jhugo@codeaurora.org>
Mon, 29 Aug 2016 20:38:51 +0000 (14:38 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2016 08:09:36 +0000 (10:09 +0200)
commit66a3f2155dbe152044e264b9737689b229fa061b
tree7b617fdef44519fff3cbec21b8a05c0a838c6aad
parent57fea0768c7c7874eeaf59b1ab5011c6cb9251b2
efi/libstub: Allocate headspace in efi_get_memory_map()

commit dadb57abc37499f565b23933dbf49b435c3ba8af 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/boot/compressed/eboot.c
drivers/firmware/efi/libstub/efi-stub-helper.c
drivers/firmware/efi/libstub/fdt.c
drivers/firmware/efi/libstub/random.c
include/linux/efi.h