]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mm/nommu: switch do_mmap_private to kernel_read
authorChristoph Hellwig <hch@lst.de>
Fri, 1 Sep 2017 15:39:17 +0000 (17:39 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 4 Sep 2017 23:05:16 +0000 (19:05 -0400)
Instead of playing with the address limit.  This also gains us
validation of the kvec and proper atime updates.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
mm/nommu.c

index fc184f597d59d9af942f8dc60229b999173fe22f..e907a25ec9bd5577fb358d8caf60e1961c539cc4 100644 (file)
@@ -1164,17 +1164,12 @@ static int do_mmap_private(struct vm_area_struct *vma,
 
        if (vma->vm_file) {
                /* read the contents of a file into the copy */
-               mm_segment_t old_fs;
                loff_t fpos;
 
                fpos = vma->vm_pgoff;
                fpos <<= PAGE_SHIFT;
 
-               old_fs = get_fs();
-               set_fs(KERNEL_DS);
-               ret = __vfs_read(vma->vm_file, base, len, &fpos);
-               set_fs(old_fs);
-
+               ret = kernel_read(vma->vm_file, base, len, &fpos);
                if (ret < 0)
                        goto error_free;