From: Matthew Leach Date: Fri, 21 Sep 2012 17:56:11 +0000 (+0100) Subject: ARM: 7540/1: kexec: Check segment memory addresses X-Git-Tag: next-20120927~119^2~2^5 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c564df4db85aac8d1d65a56176a0a25f46138064;p=karo-tx-linux.git ARM: 7540/1: kexec: Check segment memory addresses 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 Signed-off-by: Will Deacon Signed-off-by: Russell King --- diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index dee34efca748..e29c3337ca81 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 @@ -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;