sys_remap_file_pages: fix ->vm_file accounting

Fix ->vm_file accounting, mmap_region() may do do_munmap().

Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Oleg Nesterov 2008-02-04 22:27:18 -08:00 • committed by Linus Torvalds
commit 8a459e44ad

View file

@ -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 {