OSDN Git Service

[ARM] Do not call flush_cache_user_range with mmap_sem held
authorDima Zavin <dima@android.com>
Wed, 28 Apr 2010 03:57:04 +0000 (20:57 -0700)
committerArve Hjønnevåg <arve@android.com>
Thu, 22 Jul 2010 22:12:19 +0000 (15:12 -0700)
commitf0aefabf2c87167b35b05fb03899b4af56e9696a
treee2bbe4dda71f499799b52e3f4d7023e4ec664bcf
parent3db84e2cdb755b0ceb6d44fbc7a59afa9e2d3001
[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>
arch/arm/include/asm/cacheflush.h
arch/arm/kernel/traps.c