Unionfs: prevent races in unionfs_fault
authorRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Mon, 7 Apr 2008 15:08:13 +0000 (11:08 -0400)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Mon, 7 Apr 2008 15:08:13 +0000 (11:08 -0400)
commite6b25c273a701f94c730f42ed09789519064b695
tree2602383ffd165e365890c8e85709a3c5df545fd7
parent9547784108cc1cf09f269411a7fd6955d5310c84
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 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