diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2021-05-02 18:57:37 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2021-06-10 18:45:10 +0300 |
commit | 8409a0d261e20180361e7afe6d89847d1bad4ce8 (patch) | |
tree | 1c489a52514e16da863c535465c2b4206189a4b7 /include/linux/uio.h | |
parent | 185ac4d43669314f31c9c27d1ffc5ebcad791351 (diff) | |
download | linux-8409a0d261e20180361e7afe6d89847d1bad4ce8.tar.xz |
sanitize iov_iter_fault_in_readable()
1) constify iov_iter argument; we are not advancing it in this primitive.
2) cap the amount requested by the amount of data in iov_iter. All
existing callers should've been safe, but the check is really cheap and
doing it here makes for easier analysis, as well as more consistent
semantics among the primitives.
3) don't bother with iterate_iovec(). Explicit loop is not any harder
to follow, and we get rid of standalone iterate_iovec() users - it's
only used by iterate_and_advance() and (soon to be gone) iterate_all_kinds().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r-- | include/linux/uio.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index ad76eef356b0..b5cf54859109 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -119,7 +119,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes); void iov_iter_advance(struct iov_iter *i, size_t bytes); void iov_iter_revert(struct iov_iter *i, size_t bytes); -int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); +int iov_iter_fault_in_readable(const struct iov_iter *i, size_t bytes); size_t iov_iter_single_seg_count(const struct iov_iter *i); size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); |