]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitc1cc302eb584e5e6e423964a06654d6a837b03e6
tree7321c0818a0d6af6ef2aa07dcc6e6f65757370cf
parent92eb6a72ae2a644681ae2c3971791b0dcbd06d3d
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