提交 b4bf802a 编写于 作者: C Christoph Hellwig 提交者: Al Viro

mm/nommu: switch do_mmap_private to kernel_read

Instead of playing with the address limit.  This also gains us
validation of the kvec and proper atime updates.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 9a779bc1
...@@ -1164,17 +1164,12 @@ static int do_mmap_private(struct vm_area_struct *vma, ...@@ -1164,17 +1164,12 @@ static int do_mmap_private(struct vm_area_struct *vma,
if (vma->vm_file) { if (vma->vm_file) {
/* read the contents of a file into the copy */ /* read the contents of a file into the copy */
mm_segment_t old_fs;
loff_t fpos; loff_t fpos;
fpos = vma->vm_pgoff; fpos = vma->vm_pgoff;
fpos <<= PAGE_SHIFT; fpos <<= PAGE_SHIFT;
old_fs = get_fs(); ret = kernel_read(vma->vm_file, base, len, &fpos);
set_fs(KERNEL_DS);
ret = __vfs_read(vma->vm_file, base, len, &fpos);
set_fs(old_fs);
if (ret < 0) if (ret < 0)
goto error_free; goto error_free;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册