linux/arch/x86/platform
Gen Zhang 4e78921ba4 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>
2019-05-25 13:48:17 +02:00
..
atom treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ce4100 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
efi efi/x86/Add missing error handling to old_memmap 1:1 mapping code 2019-05-25 13:48:17 +02:00
geode treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
goldfish treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
intel treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
intel-mid treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
intel-quark treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
iris treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 70 2019-05-24 17:36:47 +02:00
olpc treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
pvh xen/pvh: correctly setup the PV EFI interface for dom0 2019-04-25 10:36:25 -04:00
scx200 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sfi treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ts5500 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
uv treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 82 2019-05-24 17:37:52 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00