diff options
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-01-08 09:54:58 +0000
committerKees Cook <keescook@google.com>2015-10-07 13:13:34 -0700
commit375a38c212a0041e740a02137fb8b3ebf081395d (patch)
parent5edd64b3c54a6f8fb563858416e1818ce39096eb (diff)
UPSTREAM: arm64/efi: add missing call to early_ioremap_reset()
The early ioremap support introduced by patch bf4b558eba92 ("arm64: add early_ioremap support") failed to add a call to early_ioremap_reset() at an appropriate time. Without this call, invocations of early_ioremap etc. that are done too late will go unnoticed and may cause corruption. This is exactly what happened when the first user of this feature was added in patch f84d02755f5a ("arm64: add EFI runtime services"). The early mapping of the EFI memory map is unmapped during an early initcall, at which time the early ioremap support is long gone. Fix by adding the missing call to early_ioremap_reset() to setup_arch(), and move the offending early_memunmap() to right after the point where the early mapping of the EFI memory map is last used. Fixes: f84d02755f5a ("arm64: add EFI runtime services") Cc: <stable@vger.kernel.org> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com> (cherry picked from commit 0e63ea48b4d8035dd0e91a3fa6fb79458b47adfb) Signed-off-by: Tomasz Figa <tfiga@chromium.org> Bug: 24475017 Change-Id: I50e35bc6f7866a1e3c4c1e10f604efe96be5eb85 Signed-off-by: Kees Cook <keescook@google.com>
2 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 110f6063d880..4a5d7343dddd 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -243,6 +243,7 @@ void __init efi_idmap_init(void)
/* boot time idmap_pg_dir is incomplete, so fill in missing parts */
+ early_memunmap(memmap.map, memmap.map_end - memmap.map);
@@ -260,7 +261,6 @@ static int __init arm64_enable_runtime_services(void)
mapsize = memmap.map_end - memmap.map;
- early_memunmap(memmap.map, mapsize);
if (efi_runtime_disabled()) {
pr_info("EFI runtime services will be disabled.\n");
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 052caaaa6e92..78572dcdc32d 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -395,6 +395,7 @@ void __init setup_arch(char **cmdline_p)
+ early_ioremap_reset();