aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-02-04 22:27:18 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-08 11:46:25 -0800
commit7e3c396b7554c761718702a1a9d519bfab2fa430 (patch)
tree8eca739771f7ae82f9245fbd52296f2f3b47d753
parent56d4009e9628d07acb194a52a655c5fb9abc014f (diff)
sys_remap_file_pages: fix ->vm_file accounting
patch 8a459e44ad837018ea5c34a9efe8eb4ad27ded26 in mainline. 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--mm/fremap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index 14bd3bf7826..69a37c2bdf8 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,
*/
if (mapping_cap_account_dirty(mapping)) {
unsigned long addr;
+ struct file *file = vma->vm_file;
flags &= MAP_NONBLOCK;
- addr = mmap_region(vma->vm_file, start, size,
+ get_file(file);
+ addr = mmap_region(file, start, size,
flags, vma->vm_flags, pgoff, 1);
+ fput(file);
if (IS_ERR_VALUE(addr)) {
err = addr;
} else {