diff options
-rw-r--r-- | fs/ceph/file.c | 3 | ||||
-rw-r--r-- | fs/cifs/file.c | 7 | ||||
-rw-r--r-- | include/linux/uio.h | 2 | ||||
-rw-r--r-- | mm/iov_iter.c | 27 | ||||
-rw-r--r-- | mm/process_vm_access.c | 6 |
5 files changed, 5 insertions, 40 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 88a6df4cbe6d..ef9115e4a6fa 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -737,13 +737,12 @@ static ssize_t ceph_sync_write(struct kiocb *iocb, const struct iovec *iov, | |||
737 | left = len; | 737 | left = len; |
738 | for (n = 0; n < num_pages; n++) { | 738 | for (n = 0; n < num_pages; n++) { |
739 | size_t plen = min_t(size_t, left, PAGE_SIZE); | 739 | size_t plen = min_t(size_t, left, PAGE_SIZE); |
740 | ret = iov_iter_copy_from_user(pages[n], &i, 0, plen); | 740 | ret = copy_page_from_iter(pages[n], 0, plen, &i); |
741 | if (ret != plen) { | 741 | if (ret != plen) { |
742 | ret = -EFAULT; | 742 | ret = -EFAULT; |
743 | break; | 743 | break; |
744 | } | 744 | } |
745 | left -= ret; | 745 | left -= ret; |
746 | iov_iter_advance(&i, ret); | ||
747 | } | 746 | } |
748 | 747 | ||
749 | if (ret < 0) { | 748 | if (ret < 0) { |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5ed03e0b8b40..2900d150654e 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2444,11 +2444,10 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, | |||
2444 | 2444 | ||
2445 | save_len = cur_len; | 2445 | save_len = cur_len; |
2446 | for (i = 0; i < nr_pages; i++) { | 2446 | for (i = 0; i < nr_pages; i++) { |
2447 | bytes = min_t(const size_t, cur_len, PAGE_SIZE); | 2447 | bytes = min_t(size_t, cur_len, PAGE_SIZE); |
2448 | copied = iov_iter_copy_from_user(wdata->pages[i], &it, | 2448 | copied = copy_page_from_iter(wdata->pages[i], 0, bytes, |
2449 | 0, bytes); | 2449 | &it); |
2450 | cur_len -= copied; | 2450 | cur_len -= copied; |
2451 | iov_iter_advance(&it, copied); | ||
2452 | /* | 2451 | /* |
2453 | * If we didn't copy as much as we expected, then that | 2452 | * If we didn't copy as much as we expected, then that |
2454 | * may mean we trod into an unmapped area. Stop copying | 2453 | * may mean we trod into an unmapped area. Stop copying |
diff --git a/include/linux/uio.h b/include/linux/uio.h index 199bcc34241b..abbe83ded630 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -62,8 +62,6 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); | |||
62 | 62 | ||
63 | size_t iov_iter_copy_from_user_atomic(struct page *page, | 63 | size_t iov_iter_copy_from_user_atomic(struct page *page, |
64 | struct iov_iter *i, unsigned long offset, size_t bytes); | 64 | struct iov_iter *i, unsigned long offset, size_t bytes); |
65 | size_t iov_iter_copy_from_user(struct page *page, | ||
66 | struct iov_iter *i, unsigned long offset, size_t bytes); | ||
67 | void iov_iter_advance(struct iov_iter *i, size_t bytes); | 65 | void iov_iter_advance(struct iov_iter *i, size_t bytes); |
68 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); | 66 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); |
69 | size_t iov_iter_single_seg_count(const struct iov_iter *i); | 67 | size_t iov_iter_single_seg_count(const struct iov_iter *i); |
diff --git a/mm/iov_iter.c b/mm/iov_iter.c index 10e46cd721de..22ec1ef068a8 100644 --- a/mm/iov_iter.c +++ b/mm/iov_iter.c | |||
@@ -129,33 +129,6 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, | |||
129 | } | 129 | } |
130 | EXPORT_SYMBOL(iov_iter_copy_from_user_atomic); | 130 | EXPORT_SYMBOL(iov_iter_copy_from_user_atomic); |
131 | 131 | ||
132 | /* | ||
133 | * This has the same sideeffects and return value as | ||
134 | * iov_iter_copy_from_user_atomic(). | ||
135 | * The difference is that it attempts to resolve faults. | ||
136 | * Page must not be locked. | ||
137 | */ | ||
138 | size_t iov_iter_copy_from_user(struct page *page, | ||
139 | struct iov_iter *i, unsigned long offset, size_t bytes) | ||
140 | { | ||
141 | char *kaddr; | ||
142 | size_t copied; | ||
143 | |||
144 | kaddr = kmap(page); | ||
145 | if (likely(i->nr_segs == 1)) { | ||
146 | int left; | ||
147 | char __user *buf = i->iov->iov_base + i->iov_offset; | ||
148 | left = __copy_from_user(kaddr + offset, buf, bytes); | ||
149 | copied = bytes - left; | ||
150 | } else { | ||
151 | copied = __iovec_copy_from_user_inatomic(kaddr + offset, | ||
152 | i->iov, i->iov_offset, bytes); | ||
153 | } | ||
154 | kunmap(page); | ||
155 | return copied; | ||
156 | } | ||
157 | EXPORT_SYMBOL(iov_iter_copy_from_user); | ||
158 | |||
159 | void iov_iter_advance(struct iov_iter *i, size_t bytes) | 132 | void iov_iter_advance(struct iov_iter *i, size_t bytes) |
160 | { | 133 | { |
161 | BUG_ON(i->count < bytes); | 134 | BUG_ON(i->count < bytes); |
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index 8505c9262b35..f32b1fbbfe69 100644 --- a/mm/process_vm_access.c +++ b/mm/process_vm_access.c | |||
@@ -46,11 +46,7 @@ static int process_vm_rw_pages(struct page **pages, | |||
46 | copy = len; | 46 | copy = len; |
47 | 47 | ||
48 | if (vm_write) { | 48 | if (vm_write) { |
49 | if (copy > iov_iter_count(iter)) | 49 | copied = copy_page_from_iter(page, offset, copy, iter); |
50 | copy = iov_iter_count(iter); | ||
51 | copied = iov_iter_copy_from_user(page, iter, | ||
52 | offset, copy); | ||
53 | iov_iter_advance(iter, copied); | ||
54 | set_page_dirty_lock(page); | 50 | set_page_dirty_lock(page); |
55 | } else { | 51 | } else { |
56 | copied = copy_page_to_iter(page, offset, copy, iter); | 52 | copied = copy_page_to_iter(page, offset, copy, iter); |