diff options
author | David Howells <[email protected]> | 2010-01-15 17:01:36 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2010-01-16 12:15:40 -0800 |
commit | 81759b5b221107488bda99fe7beeb7b734f61133 (patch) | |
tree | 2ca1207d4ae5d6bbdc49db727a35b22a502fc76f /net/lapb/lapb_in.c | |
parent | efc1a3b16930c41d64ffefde16b87d82f603a8a0 (diff) |
nommu: fix race between ramfs truncation and shared mmap
Fix the race between the truncation of a ramfs file and an attempt to make
a shared mmap of region of that file.
The problem is that do_mmap_pgoff() calls f_op->get_unmapped_area() to
verify that the file region is made of contiguous pages and to find its
base address - but there isn't any locking to guarantee this region until
vma_prio_tree_insert() is called by add_vma_to_mm().
Note that moving the functionality into f_op->mmap() doesn't help as that
is also called before vma_prio_tree_insert().
Instead make ramfs_nommu_check_mappings() grab nommu_region_sem whilst it
does its checks. This means that this function will wait whilst mmaps
take place.
Signed-off-by: David Howells <[email protected]>
Acked-by: Al Viro <[email protected]>
Cc: Greg Ungerer <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/lapb/lapb_in.c')
0 files changed, 0 insertions, 0 deletions