projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SELinux: fix sleeping allocation in security_context_to_sid
[firefly-linux-kernel-4.4.55.git]
/
mm
/
fremap.c
diff --git
a/mm/fremap.c
b/mm/fremap.c
index 95bcb5641c722b6f4d7eb49801320e0a266f7c83..07a9c82ce1a3fa0e24da2f2da23e9416e3f1819c 100644
(file)
--- a/
mm/fremap.c
+++ b/
mm/fremap.c
@@
-5,7
+5,7
@@
*
* started by Ingo Molnar, Copyright (C) 2002, 2003
*/
*
* started by Ingo Molnar, Copyright (C) 2002, 2003
*/
-
+#include <linux/backing-dev.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/file.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/file.h>
@@
-97,26
+97,28
@@
static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma,
}
}
-/***
- * sys_remap_file_pages - remap arbitrary pages of a shared backing store
- * file within an existing vma.
+/**
+ * sys_remap_file_pages - remap arbitrary pages of an existing VM_SHARED vma
* @start: start of the remapped virtual memory range
* @size: size of the remapped virtual memory range
* @start: start of the remapped virtual memory range
* @size: size of the remapped virtual memory range
- * @prot: new protection bits of the range
- * @pgoff: to
be
mapped page of the backing store file
+ * @prot: new protection bits of the range
(see NOTE)
+ * @pgoff: to
-be-
mapped page of the backing store file
* @flags: 0 or MAP_NONBLOCKED - the later will cause no IO.
*
* @flags: 0 or MAP_NONBLOCKED - the later will cause no IO.
*
- * this syscall works purely via pagetables, so it's the most efficient
+ * sys_remap_file_pages remaps arbitrary pages of an existing VM_SHARED vma
+ * (shared backing store file).
+ *
+ * This syscall works purely via pagetables, so it's the most efficient
* way to map the same (large) file into a given virtual window. Unlike
* mmap()/mremap() it does not create any new vmas. The new mappings are
* also safe across swapout.
*
* way to map the same (large) file into a given virtual window. Unlike
* mmap()/mremap() it does not create any new vmas. The new mappings are
* also safe across swapout.
*
- * NOTE: the
'prot' parameter right now is ignored, and the vma's default
- *
protection is used. Arbitrary protections might be implemented in the
- * future.
+ * NOTE: the
@prot parameter right now is ignored (but must be zero),
+ *
and the vma's default protection is used. Arbitrary protections
+ *
might be implemented in the
future.
*/
asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
*/
asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
- unsigned long
__
prot, unsigned long pgoff, unsigned long flags)
+ unsigned long prot, unsigned long pgoff, unsigned long flags)
{
struct mm_struct *mm = current->mm;
struct address_space *mapping;
{
struct mm_struct *mm = current->mm;
struct address_space *mapping;
@@
-125,7
+127,7
@@
asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
int err = -EINVAL;
int has_write_lock = 0;
int err = -EINVAL;
int has_write_lock = 0;
- if (
__
prot)
+ if (prot)
return err;
/*
* Sanitize the syscall parameters:
return err;
/*
* Sanitize the syscall parameters:
@@
-188,10
+190,13
@@
asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
*/
if (mapping_cap_account_dirty(mapping)) {
unsigned long addr;
*/
if (mapping_cap_account_dirty(mapping)) {
unsigned long addr;
+ struct file *file = vma->vm_file;
flags &= MAP_NONBLOCK;
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);
flags, vma->vm_flags, pgoff, 1);
+ fput(file);
if (IS_ERR_VALUE(addr)) {
err = addr;
} else {
if (IS_ERR_VALUE(addr)) {
err = addr;
} else {