diff options
author | Dima Zavin <dima@android.com> | 2010-04-28 03:57:04 -0700 |
---|---|---|
committer | Xinyu Chen <xinyu.chen@freescale.com> | 2011-09-02 16:43:12 +0800 |
commit | 5e6f00a201921427aaa8605bbd90ad235106871f (patch) | |
tree | 5455bdc47bb6251a2d44a19cd3b5e6aa76676af3 /arch/arm/kernel | |
parent | 70e2764590ba06acf0b5b3215666a6dc032b1434 (diff) |
Do not call flush_cache_user_range with mmap_sem held
[ARM] Do not call flush_cache_user_range with mmap_sem held
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.
Also, since we really can't be holding the mmap_sem while calling
flush_cache_user_range AND vma is actually unused by the flush itself,
get rid of vma as an argument.
Change-Id: If55409bde41ad1060fa4fe7cbd4ac530d4d9a106
Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/traps.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 1621e5327b2a..2455fd36e82c 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -453,7 +453,9 @@ do_cache_op(unsigned long start, unsigned long end, int flags) if (end > vma->vm_end) end = vma->vm_end; - flush_cache_user_range(vma, start, end); + up_read(&mm->mmap_sem); + flush_cache_user_range(start, end); + return; } up_read(&mm->mmap_sem); } |