Re: [patch 2/2] hugetlb: add /dev/hugetlb char device

From: Christoph Hellwig
Date: Sat Mar 24 2007 - 03:41:53 EST


> +int hugetlb_zero_setup(struct file *file, struct vm_area_struct *vma)
> +{
> + file = hugetlb_file_setup(vma->vm_end - vma->vm_start, 0);
> + if (IS_ERR(file))
> + return PTR_ERR(file);
> +
> + if (vma->vm_file)
> + fput(vma->vm_file);
> + vma->vm_file = file;
> + return hugetlbfs_file_mmap(file, vma);
> +}

Setting vma->vm_file to something that is not the file we called mmap
on and even refers to a different inode seems rather dangerous.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/