Unionfs: prevent races in unionfs_fault
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 17:05:52 +0000 (13:05 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:38:05 +0000 (22:38 -0400)
commit20413ea49736b70c60005da7e37d09c8db1d556c
treefe96f4165c190bb0788d4eb8dfa67780078f14eb
parent6d9a9301a3dc0ad98dfad5541a6767114161f3c0
Unionfs: prevent races in unionfs_fault

vm_ops->fault may be called in parallel.  Because we have to resort to
temporarily changing the vma->vm_file to point to the lower file, a
concurrent invocation of unionfs_fault could see a different value.  In this
workaround, we keep a different copy of the vma structure in our stack, so
we never expose a different value of the vma->vm_file called to us, even
temporarily.  A better fix (already tested) would be to change the calling
semantics of ->fault to take an explicit file pointer.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/mmap.c