linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: matthew.leach@arm.com (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	[thread overview]
Message-ID: <1346938503-18142-3-git-send-email-matthew.leach@arm.com> (raw)
In-Reply-To: <1346938503-18142-1-git-send-email-matthew.leach@arm.com>

Ensure that the memory regions that are set within the segments
correspond to physical contiguous memory regions.

Cc: Simon Horman <horms@verge.net.au>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Matthew Leach <matthew.leach@arm.com>
---
 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 <linux/reboot.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/memblock.h>
 #include <asm/pgtable.h>
 #include <linux/of_fdt.h>
 #include <asm/pgalloc.h>
@@ -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;
-- 
1.7.12

  parent reply	other threads:[~2012-09-06 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 13:35 [RFC PATCH 0/2] ARM: kexec: Add dtb kexec support Matthew Leach
2012-09-06 13:35 ` [RFC PATCH 1/2] ARM: kexec: scan for dtb magic in segments Matthew Leach
2012-09-07  0:55   ` Simon Horman
2012-09-06 13:35 ` Matthew Leach [this message]
2012-09-07  0:55   ` [RFC PATCH 2/2] ARM: kexec: Check segment memory addresses Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346938503-18142-3-git-send-email-matthew.leach@arm.com \
    --to=matthew.leach@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).