diff options
author | Christoph Hellwig <hch@lst.de> | 2017-09-01 11:39:17 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-04 19:05:16 -0400 |
commit | b4bf802a5a6563c22d5e41a0f8873088bd3f655e (patch) | |
tree | 4566651bc3e7b65d0308ebe092f4446b2605ce24 | |
parent | 9a779bc149c79a7acae5614617a0a9e0fd007ce4 (diff) |
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: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | mm/nommu.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index fc184f597d59..e907a25ec9bd 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1164,17 +1164,12 @@ static int do_mmap_private(struct vm_area_struct *vma, | |||
1164 | 1164 | ||
1165 | if (vma->vm_file) { | 1165 | if (vma->vm_file) { |
1166 | /* read the contents of a file into the copy */ | 1166 | /* read the contents of a file into the copy */ |
1167 | mm_segment_t old_fs; | ||
1168 | loff_t fpos; | 1167 | loff_t fpos; |
1169 | 1168 | ||
1170 | fpos = vma->vm_pgoff; | 1169 | fpos = vma->vm_pgoff; |
1171 | fpos <<= PAGE_SHIFT; | 1170 | fpos <<= PAGE_SHIFT; |
1172 | 1171 | ||
1173 | old_fs = get_fs(); | 1172 | ret = kernel_read(vma->vm_file, base, len, &fpos); |
1174 | set_fs(KERNEL_DS); | ||
1175 | ret = __vfs_read(vma->vm_file, base, len, &fpos); | ||
1176 | set_fs(old_fs); | ||
1177 | |||
1178 | if (ret < 0) | 1173 | if (ret < 0) |
1179 | goto error_free; | 1174 | goto error_free; |
1180 | 1175 | ||