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, 13 Jan 2009 02:33:33 +0000 (21:33 -0500)
commit77f2c6e3db8178fa2af87a0662d4c7e84f9eb9c6
tree080a75003f90b75494d468f7e542092fd8228e5b
parent4cd7a19de500c9e47e92e1cbb9764950ee32d04b
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