[lkml]   [2012]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[ 54/55] ARM: 7409/1: Do not call flush_cache_user_range with mmap_sem held
3.0-stable review patch.  If anyone has any objections, please let me know.


From: Dima Zavin <>

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 <>
Signed-off-by: Dima Zavin <>
Signed-off-by: John Stultz <>
Signed-off-by: Will Deacon <>
Signed-off-by: Russell King <>
Signed-off-by: Greg Kroah-Hartman <>

arch/arm/kernel/traps.c | 2 ++
1 file changed, 2 insertions(+)

--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -451,7 +451,9 @@ do_cache_op(unsigned long start, unsigne
if (end > vma->vm_end)
end = vma->vm_end;

+ up_read(&mm->mmap_sem);
flush_cache_user_range(start, end);
+ return;

 \ /
  Last update: 2012-05-27 04:21    [W:0.387 / U:4.208 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site