From: Oleg Nesterov Date: Tue, 5 Feb 2008 06:27:18 +0000 (-0800) Subject: sys_remap_file_pages: fix ->vm_file accounting X-Git-Tag: v2.6.25-rc1~1053 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a459e44ad837018ea5c34a9efe8eb4ad27ded26;p=linux-2.6 sys_remap_file_pages: fix ->vm_file accounting Fix ->vm_file accounting, mmap_region() may do do_munmap(). Signed-off-by: Oleg Nesterov Signed-off-by: Miklos Szeredi Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/fremap.c b/mm/fremap.c index 14bd3bf782..69a37c2bdf 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 {