VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / fs / hugetlbfs / inode.c
index f2893bb..4ec4283 100644 (file)
@@ -52,6 +52,9 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
        loff_t len, vma_len;
        int ret;
 
+       if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1))
+               return -EINVAL;
+
        if (vma->vm_start & ~HPAGE_MASK)
                return -EINVAL;
 
@@ -278,16 +281,16 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
                unsigned long v_length;
                unsigned long v_offset;
 
-               h_vm_pgoff = vma->vm_pgoff << (HPAGE_SHIFT - PAGE_SHIFT);
-               v_length = vma->vm_end - vma->vm_start;
+               h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
                v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
-
                /*
                 * Is this VMA fully outside the truncation point?
                 */
                if (h_vm_pgoff >= h_pgoff)
                        v_offset = 0;
 
+               v_length = vma->vm_end - vma->vm_start;
+
                zap_hugepage_range(vma,
                                vma->vm_start + v_offset,
                                v_length - v_offset);
@@ -329,9 +332,6 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
        if (error)
                goto out;
 
-       error = security_inode_setattr(dentry, attr);
-       if (error)
-               goto out;
        if (ia_valid & ATTR_SIZE) {
                error = -EINVAL;
                if (!(attr->ia_size & ~HPAGE_MASK))