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>
Wed, 6 Jan 2010 03:44:47 +0000 (22:44 -0500)
commit12e2142a41a4ccf5031698798376942f501da3ba
treedc7c789c41e5d4968a8f2ff5be2469226975a166
parent3a5d4b73805a078198a7b499f7fce8ca1cb41ef9
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