From patchwork Fri Sep 7 08:41:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Leach X-Patchwork-Id: 1420651 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A24CF3FC33 for ; Fri, 7 Sep 2012 08:44:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9u7s-0007Uu-B8; Fri, 07 Sep 2012 08:41:20 +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 1T9u7e-0007RL-F1 for linux-arm-kernel@lists.infradead.org; Fri, 07 Sep 2012 08:41:07 +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 q878f1E9001192; Fri, 7 Sep 2012 09:41:02 +0100 (BST) From: Matthew Leach To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] ARM: kexec: Check segment memory addresses Date: Fri, 7 Sep 2012 09:41:00 +0100 Message-Id: <1347007260-13271-3-git-send-email-matthew.leach@arm.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347007260-13271-1-git-send-email-matthew.leach@arm.com> References: <1347007260-13271-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 , horms@verge.net.au, will.deacon@arm.com 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. Reviewed-by: Simon Horman Reviewed-by: Will Deacon Signed-off-by: Matthew Leach --- 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;