[RESEND PATCH 2/2] ARM: kexec: Check segment memory addresses

Will Deacon will.deacon at arm.com
Thu Sep 20 12:03:38 EDT 2012


From: Matthew Leach <matthew.leach at arm.com>

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

Reviewed-by: Simon Horman <horms at verge.net.au>
Reviewed-by: Will Deacon <will.deacon at arm.com>
Signed-off-by: Matthew Leach <matthew.leach at arm.com>
Signed-off-by: Will Deacon <will.deacon at arm.com>
---
 arch/arm/kernel/machine_kexec.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index dee34ef..e29c333 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>
@@ -44,6 +45,11 @@ 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.4.1




More information about the linux-arm-kernel mailing list