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>
Tue, 11 Nov 2014 16:06:17 +0000 (11:06 -0500)
commitacf992c1c521a2ca20b75ca7d0be2d1ea140307c
treef603e550ea2ff6927b6ff397492900d6085f03c9
parent25c11df7d2d7c7e5b2b5ae7355a1ccff2cfd2747
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