m68k: call find_vma with the mmap_sem held in sys_cacheflush()
authorDavidlohr Bueso <davidlohr@hp.com>
Thu, 9 Oct 2014 22:29:45 +0000 (15:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Oct 2014 02:26:02 +0000 (22:26 -0400)
commitcd2567b6850b1648236a4aab0513a04ebaea6aa8
tree7321c0818a0d6af6ef2aa07dcc6e6f65757370cf
parent7cc36bbddde5cd0c98f0c06e3304ab833d662565
m68k: call find_vma with the mmap_sem held in sys_cacheflush()

Performing vma lookups without taking the mm->mmap_sem is asking for
trouble.  While doing the search, the vma in question can be modified or
even removed before returning to the caller.  Take the lock (shared) in
order to avoid races while iterating through the vmacache and/or rbtree.
In addition, this guarantees that the address space will remain intact
during the CPU flushing.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/m68k/kernel/sys_m68k.c