From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751771AbdITEqC (ORCPT ); Wed, 20 Sep 2017 00:46:02 -0400 Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:65018 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751634AbdITEpv (ORCPT ); Wed, 20 Sep 2017 00:45:51 -0400 From: "Levin, Alexander (Sasha Levin)" Cc: Marcin Nowakowski , "linux-mips@linux-mips.org" , Ralf Baechle , "Levin, Alexander (Sasha Levin)" X-Host: discovery.odc.vzwcorp.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH review for 4.4 07/47] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Thread-Topic: [PATCH review for 4.4 07/47] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Thread-Index: AQHTMcs4C4AhdCkcEUGC3CNSWM63CA== Date: Wed, 20 Sep 2017 04:45:01 +0000 Message-ID: <20170920044445.7392-7-alexander.levin@verizon.com> References: <20170920044445.7392-1-alexander.levin@verizon.com> In-Reply-To: <20170920044445.7392-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8K4w2cG025111 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 8acae316f26b..68f1118d10ad 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -596,6 +596,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; } -- 2.11.0