From patchwork Thu Sep 6 13:35:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Leach X-Patchwork-Id: 1415021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2CBC0DFFCF for ; Thu, 6 Sep 2012 13:38:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9cFI-0006sI-R1; Thu, 06 Sep 2012 13:35:48 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9cF1-0006pT-Ec for linux-arm-kernel@lists.infradead.org; Thu, 06 Sep 2012 13:35:37 +0000 Received: from e106299-lin.cambridge.arm.com (e106299-lin.cambridge.arm.com [10.1.193.74]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id q86DZRE9004948; Thu, 6 Sep 2012 14:35:28 +0100 (BST) From: Matthew Leach To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/2] ARM: kexec: Check segment memory addresses Date: Thu, 6 Sep 2012 14:35:03 +0100 Message-Id: <1346938503-18142-3-git-send-email-matthew.leach@arm.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346938503-18142-1-git-send-email-matthew.leach@arm.com> References: <1346938503-18142-1-git-send-email-matthew.leach@arm.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Matthew Leach , Simon Horman X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Ensure that the memory regions that are set within the segments correspond to physical contiguous memory regions. Cc: Simon Horman Reviewed-by: Will Deacon Signed-off-by: Matthew Leach Reviewed-by: Simon Horman --- arch/arm/kernel/machine_kexec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index a6bbc0f..524139a 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,12 @@ int machine_kexec_prepare(struct kimage *image) for (i = 0; i < image->nr_segments; i++) { current_segment = &image->segment[i]; + err = memblock_is_region_memory(current_segment->mem, + current_segment->memsz); + if (err) + return - EINVAL; + + err = get_user(header, (__be32*)current_segment->buf); if (err) return err;