diff options
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r-- | fs/hugetlbfs/inode.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index c848a191525d..950c2fbb815b 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -82,14 +82,19 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
82 | int ret; | 82 | int ret; |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * vma alignment has already been checked by prepare_hugepage_range. | 85 | * vma address alignment (but not the pgoff alignment) has |
86 | * If you add any error returns here, do so after setting VM_HUGETLB, | 86 | * already been checked by prepare_hugepage_range. If you add |
87 | * so is_vm_hugetlb_page tests below unmap_region go the right way | 87 | * any error returns here, do so after setting VM_HUGETLB, so |
88 | * when do_mmap_pgoff unwinds (may be important on powerpc and ia64). | 88 | * is_vm_hugetlb_page tests below unmap_region go the right |
89 | * way when do_mmap_pgoff unwinds (may be important on powerpc | ||
90 | * and ia64). | ||
89 | */ | 91 | */ |
90 | vma->vm_flags |= VM_HUGETLB | VM_RESERVED; | 92 | vma->vm_flags |= VM_HUGETLB | VM_RESERVED; |
91 | vma->vm_ops = &hugetlb_vm_ops; | 93 | vma->vm_ops = &hugetlb_vm_ops; |
92 | 94 | ||
95 | if (vma->vm_pgoff & ~(HPAGE_MASK >> PAGE_SHIFT)) | ||
96 | return -EINVAL; | ||
97 | |||
93 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); | 98 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); |
94 | 99 | ||
95 | mutex_lock(&inode->i_mutex); | 100 | mutex_lock(&inode->i_mutex); |
@@ -132,7 +137,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, | |||
132 | return -ENOMEM; | 137 | return -ENOMEM; |
133 | 138 | ||
134 | if (flags & MAP_FIXED) { | 139 | if (flags & MAP_FIXED) { |
135 | if (prepare_hugepage_range(addr, len, pgoff)) | 140 | if (prepare_hugepage_range(addr, len)) |
136 | return -EINVAL; | 141 | return -EINVAL; |
137 | return addr; | 142 | return addr; |
138 | } | 143 | } |