]> asedeno.scripts.mit.edu Git - linux.git/commit
efi/x86/Add missing error handling to old_memmap 1:1 mapping code
authorGen Zhang <blackgod016574@gmail.com>
Sat, 25 May 2019 11:25:58 +0000 (13:25 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 25 May 2019 11:48:17 +0000 (13:48 +0200)
commit4e78921ba4dd0aca1cc89168f45039add4183f8e
treedd15e68697a26fec29e8bd71014208e55c319b52
parent2409207a73cc8e4aff75ceccf6fe5c3ce4d391bc
efi/x86/Add missing error handling to old_memmap 1:1 mapping code

The old_memmap flow in efi_call_phys_prolog() performs numerous memory
allocations, and either does not check for failure at all, or it does
but fails to propagate it back to the caller, which may end up calling
into the firmware with an incomplete 1:1 mapping.

So let's fix this by returning NULL from efi_call_phys_prolog() on
memory allocation failures only, and by handling this condition in the
caller. Also, clean up any half baked sets of page tables that we may
have created before returning with a NULL return value.

Note that any failure at this level will trigger a panic() two levels
up, so none of this makes a huge difference, but it is a nice cleanup
nonetheless.

[ardb: update commit log, add efi_call_phys_epilog() call on error path]

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Bradford <robert.bradford@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20190525112559.7917-2-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/platform/efi/efi.c
arch/x86/platform/efi/efi_64.c