Commit 8a459e44 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

sys_remap_file_pages: fix ->vm_file accounting

Fix ->vm_file accounting, mmap_region() may do do_munmap().
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c0b49b0d
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment