ARM: 7917/1: cacheflush: correctly limit range of memory region being flushed

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.

Cc: <stable@vger.kernel.org>
Reported-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Jon Medhurst 2013-12-09 13:45:46 +01:00 committed by Russell King
parent 3abb6671a9
commit b31459adea
1 changed files with 2 additions and 1 deletions

View File

@ -509,9 +509,10 @@ static inline int
__do_cache_op(unsigned long start, unsigned long end) __do_cache_op(unsigned long start, unsigned long end)
{ {
int ret; int ret;
unsigned long chunk = PAGE_SIZE;
do { do {
unsigned long chunk = min(PAGE_SIZE, end - start);
if (signal_pending(current)) { if (signal_pending(current)) {
struct thread_info *ti = current_thread_info(); struct thread_info *ti = current_thread_info();