aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-02-05 01:27:18 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:07 -0500
commit8a459e44ad837018ea5c34a9efe8eb4ad27ded26 (patch)
treeb2c479cc980c9793677302574005b97e05732d74
parentc0b49b0d164c4902e53c17d90e2c5e5a2ac9e132 (diff)
sys_remap_file_pages: fix ->vm_file accounting
Fix ->vm_file accounting, mmap_region() may do do_munmap(). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/fremap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index 14bd3bf7826e..69a37c2bdf81 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -190,10 +190,13 @@ asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
190 */ 190 */
191 if (mapping_cap_account_dirty(mapping)) { 191 if (mapping_cap_account_dirty(mapping)) {
192 unsigned long addr; 192 unsigned long addr;
193 struct file *file = vma->vm_file;
193 194
194 flags &= MAP_NONBLOCK; 195 flags &= MAP_NONBLOCK;
195 addr = mmap_region(vma->vm_file, start, size, 196 get_file(file);
197 addr = mmap_region(file, start, size,
196 flags, vma->vm_flags, pgoff, 1); 198 flags, vma->vm_flags, pgoff, 1);
199 fput(file);
197 if (IS_ERR_VALUE(addr)) { 200 if (IS_ERR_VALUE(addr)) {
198 err = addr; 201 err = addr;
199 } else { 202 } else {