diff options
-rw-r--r-- | mm/fremap.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/fremap.c b/mm/fremap.c index 6a8da7ee85fd..4723ac8d2fc2 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -129,7 +129,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, | |||
129 | struct vm_area_struct *vma; | 129 | struct vm_area_struct *vma; |
130 | int err = -EINVAL; | 130 | int err = -EINVAL; |
131 | int has_write_lock = 0; | 131 | int has_write_lock = 0; |
132 | vm_flags_t vm_flags; | 132 | vm_flags_t vm_flags = 0; |
133 | 133 | ||
134 | if (prot) | 134 | if (prot) |
135 | return err; | 135 | return err; |
@@ -163,8 +163,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, | |||
163 | * and that the remapped range is valid and fully within | 163 | * and that the remapped range is valid and fully within |
164 | * the single existing vma. | 164 | * the single existing vma. |
165 | */ | 165 | */ |
166 | vm_flags = vma->vm_flags; | 166 | if (!vma || !(vma->vm_flags & VM_SHARED)) |
167 | if (!vma || !(vm_flags & VM_SHARED)) | ||
168 | goto out; | 167 | goto out; |
169 | 168 | ||
170 | if (!vma->vm_ops || !vma->vm_ops->remap_pages) | 169 | if (!vma->vm_ops || !vma->vm_ops->remap_pages) |