From: Oleg Nesterov Date: Tue, 5 Feb 2008 06:27:18 +0000 (-0800) Subject: sys_remap_file_pages: fix ->vm_file accounting X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8a459e44ad837018ea5c34a9efe8eb4ad27ded26;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git 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 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, */ 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 {