]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
efi/esrt: Fix handling of early ESRT table mapping
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 12 Mar 2018 08:44:59 +0000 (08:44 +0000)
committerIngo Molnar <mingo@kernel.org>
Mon, 12 Mar 2018 09:05:01 +0000 (10:05 +0100)
commit136d5d57e35cc6985c57d23d0c823133e3508bed
tree9861b6a4c9c7abfbe836114493fc3551f25f0268
parent7e904a91bf6049071ef9d605a52f863ae774081d
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>
drivers/firmware/efi/esrt.c