summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMarcin Nowakowski <marcin.nowakowski@imgtec.com>2016-11-23 14:43:50 +0100
committerRalf Baechle <ralf@linux-mips.org>2017-01-03 16:34:46 +0100
commita8f108d70c74d83574c157648383eb2e4285a190 (patch)
treea055192b7a1fc249aa9459090b96ac827df77f7a /arch
parentMIPS: fix mem=X@Y commandline processing (diff)
downloadlinux-a8f108d70c74d83574c157648383eb2e4285a190.tar.xz
linux-a8f108d70c74d83574c157648383eb2e4285a190.zip
MIPS: kexec: Do not reserve invalid crashkernel memory on boot
Do not reserve memory for the crashkernel if the commandline argument points to a wrong location. This can happen if the location is specified wrong or if the same commandline is reused when starting the crashkernel - in the latter case the reserved memory would point to the location from which the crashkernel is executing. Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14612/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/kernel/setup.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index ae888662bda3..01d1dbde5fbf 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -741,6 +741,11 @@ static void __init mips_parse_crashkernel(void)
if (ret != 0 || crash_size <= 0)
return;
+ if (!memory_region_available(crash_base, crash_size)) {
+ pr_warn("Invalid memory region reserved for crash kernel\n");
+ return;
+ }
+
crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1;
}