Unionfs: prevent races in unionfs_fault
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 17:25:21 +0000 (13:25 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sat, 19 Jul 2008 03:22:58 +0000 (23:22 -0400)
commit1b157803033965a7be6000b4e7b0eac5110c4b87
tree0426bdb9d311487982ab14e35e3464977b89a036
parent60735d25f23afa3f1c236b0d035b7a6cf790ebe3
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