summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2012-04-30 10:26:14 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-01 15:18:28 +0800
commit8209f1cb6873c4e43fba6e768d244b77f1c9d4b3 (patch)
tree61330673fc0128d5c1a2e49539cca77fe8ac86b1
parent6019ae78aa65afe273da8c0dfeed8e89fb5edf8f (diff)
ARM: 7409/1: Do not call flush_cache_user_range with mmap_sem held
commit 435a7ef52db7d86e67a009b36cac1457f8972391 upstream. We can't be holding the mmap_sem while calling flush_cache_user_range because the flush can fault. If we fault on a user address, the page fault handler will try to take mmap_sem again. Since both places acquire the read lock, most of the time it succeeds. However, if another thread tries to acquire the write lock on the mmap_sem (e.g. mmap) in between the call to flush_cache_user_range and the fault, the down_read in do_page_fault will deadlock. [will: removed drop of vma parameter as already queued by rmk (7365/1)] Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Dima Zavin <dima@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm/kernel/traps.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 55b2f3dc6bb3..63d402f75e25 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -496,7 +496,9 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
if (end > vma->vm_end)
end = vma->vm_end;
+ up_read(&mm->mmap_sem);
flush_cache_user_range(start, end);
+ return;
}
up_read(&mm->mmap_sem);
}