]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
efi/x86: Map the entire EFI vendor string before copying it
authorArd Biesheuvel <ardb@kernel.org>
Fri, 3 Jan 2020 11:39:37 +0000 (12:39 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 24 Feb 2020 15:19:28 +0000 (16:19 +0100)
commit87a75805d54fd2289b8b96636f0e379830aff33b
treedbfd282887880dca0902b3e9885b8b7ba07c734a
parentaf0e01308cf84f5ff5aad70522832fec4fc25b03
efi/x86: Map the entire EFI vendor string before copying it

BugLink: https://bugs.launchpad.net/bugs/1864488
[ Upstream commit ffc2760bcf2dba0dbef74013ed73eea8310cc52c ]

Fix a couple of issues with the way we map and copy the vendor string:
- we map only 2 bytes, which usually works since you get at least a
  page, but if the vendor string happens to cross a page boundary,
  a crash will result
- only call early_memunmap() if early_memremap() succeeded, or we will
  call it with a NULL address which it doesn't like,
- while at it, switch to early_memremap_ro(), and array indexing rather
  than pointer dereferencing to read the CHAR16 characters.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Matthew Garrett <mjg59@google.com>
Cc: linux-efi@vger.kernel.org
Fixes: 5b83683f32b1 ("x86: EFI runtime service support")
Link: https://lkml.kernel.org/r/20200103113953.9571-5-ardb@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/x86/platform/efi/efi.c