From 2925f142d855585427a63da50744766a47659e0f Mon Sep 17 00:00:00 2001 From: Jon Medhurst Date: Mon, 9 Dec 2013 13:45:46 +0100 Subject: ARM: 7917/1: cacheflush: correctly limit range of memory region being flushed commit b31459adeab018b297541e288ac88873011da82a upstream. The __do_cache_op function operates with a 'chunk' size of one page but fails to limit the size of the final chunk so as to not exceed the specified memory region. Fix this. Reported-by: Christian Gmeiner Tested-by: Christian Gmeiner Acked-by: Will Deacon Signed-off-by: Jon Medhurst Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 8fcda14..65ed63f 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -503,9 +503,10 @@ static inline int __do_cache_op(unsigned long start, unsigned long end) { int ret; - unsigned long chunk = PAGE_SIZE; do { + unsigned long chunk = min(PAGE_SIZE, end - start); + if (signal_pending(current)) { struct thread_info *ti = current_thread_info(); -- cgit v0.10.2