Return-Path: Received: from fldsmtpe03.verizon.com ([140.108.26.142]:53355 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751945AbdITEqa (ORCPT ); Wed, 20 Sep 2017 00:46:30 -0400 From: "Levin, Alexander (Sasha Levin)" Cc: Marcin Nowakowski , "linux-mips@linux-mips.org" , Ralf Baechle , "Levin, Alexander (Sasha Levin)" To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH review for 3.18 04/30] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Date: Wed, 20 Sep 2017 04:45:51 +0000 Message-ID: <20170920044542.7571-4-alexander.levin@verizon.com> References: <20170920044542.7571-1-alexander.levin@verizon.com> In-Reply-To: <20170920044542.7571-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Marcin Nowakowski [ Upstream commit a8f108d70c74d83574c157648383eb2e4285a190 ] 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 Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14612/ Signed-off-by: Ralf Baechle Signed-off-by: Sasha Levin --- arch/mips/kernel/setup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index f3b635f86c39..e3f552642a68 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -585,6 +585,11 @@ static void __init mips_parse_crashkernel(void) if (ret !=3D 0 || crash_size <=3D 0) return; =20 + if (!memory_region_available(crash_base, crash_size)) { + pr_warn("Invalid memory region reserved for crash kernel\n"); + return; + } + crashk_res.start =3D crash_base; crashk_res.end =3D crash_base + crash_size - 1; } --=20 2.11.0