linux-stable/drivers/firmware/efi
Ard Biesheuvel 136d5d57e3 efi/esrt: Fix handling of early ESRT table mapping
As reported by Tyler, efi_esrt_init() will return without releasing the
ESRT table header mapping if it encounters a table with an unexpected
version. Replacing the 'return' with 'goto err_memunmap' would fix this
particular occurrence, but, as it turns out, the code is rather peculiar
to begin with:

 - it never uses the header mapping after memcpy()'ing out its contents,
 - it maps and unmaps the entire table without ever looking at the
   contents.

So let's refactor this code to unmap the table header right after the
memcpy() so we can get rid of the error handling path altogether, and
drop the second mapping entirely.

Reported-by: Tyler Baicar <tbaicar@codeaurora.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Jones <pjones@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20180312084500.10764-5-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-03-12 10:05:01 +01:00
..
libstub efi: call get_event_log before ExitBootServices 2018-01-08 12:58:35 +02:00
test License cleanup: add SPDX license identifiers to some files 2017-11-02 10:04:46 -07:00
apple-properties.c efi/apple-properties: Use memremap() instead of ioremap() 2018-03-09 08:58:23 +01:00
arm-init.c efi/arm/arm64: Add missing assignment of efi.config_table 2017-08-21 09:43:49 +02:00
arm-runtime.c efi: Use efi_mm in x86 as well as ARM 2018-03-12 10:05:01 +01:00
capsule-loader.c efi/capsule-loader: Fix pr_err() string to end with newline 2018-01-03 14:03:48 +01:00
capsule.c efi/capsule-loader: Use page addresses rather than struct page pointers 2017-06-05 17:50:41 +02:00
cper-arm.c efi: Parse ARM error information value 2018-01-03 14:03:48 +01:00
cper.c efi: Move ARM CPER code to new file 2018-01-03 14:03:48 +01:00
dev-path-parser.c efi: Add device path parser 2016-11-13 08:23:15 +01:00
efi-bgrt.c efi/bgrt: Use efi_mem_type() 2017-08-26 09:20:33 +02:00
efi-pstore.c pstore: Populate pstore record->time field 2017-05-31 10:13:44 -07:00
efi.c efi: Use efi_mm in x86 as well as ARM 2018-03-12 10:05:01 +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: Fix handling of early ESRT table mapping 2018-03-12 10:05:01 +01:00
fake_mem.c x86/efi: Don't allocate memmap through memblock after mm_init() 2017-01-07 08:58:07 +01:00
Kconfig Kconfig updates for v4.16 2018-02-01 11:45:49 -08:00
Makefile Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2018-01-31 13:12:31 -08:00
memattr.c x86/efi: Add support for EFI_MEMORY_ATTRIBUTES_TABLE 2017-02-01 08:45:44 +01:00
memmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
reboot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
runtime-map.c efi: Move some sysfs files to be read-only by root 2017-12-06 19:31:39 +01:00
runtime-wrappers.c efi: Replace runtime services spinlock with semaphore 2016-09-09 16:08:43 +01:00
tpm.c efi: call get_event_log before ExitBootServices 2018-01-08 12:58:35 +02:00
vars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00