diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-09 22:13:46 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-09 22:13:46 +0300 |
commit | 7b7699c09f66f180b9a8a5010df352acb8683bfa (patch) | |
tree | 5f5e4472beba0cf247dc9003aced072e65172791 /include/linux | |
parent | 70868a180501d17fea58153c649d56bc18435315 (diff) | |
parent | 89c2b3b74918200e46699338d7bcc19b1ea12110 (diff) | |
download | linux-7b7699c09f66f180b9a8a5010df352acb8683bfa.tar.xz |
Merge branch 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull iov_iter fixes from Al Viro:
"Fixes for io-uring handling of iov_iter reexpands"
* 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
io_uring: reexpand under-reexpanded iters
iov_iter: track truncated size
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/uio.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index 82c3c3e819e0..5265024e8b90 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -47,6 +47,7 @@ struct iov_iter { }; loff_t xarray_start; }; + size_t truncated; }; static inline enum iter_type iov_iter_type(const struct iov_iter *i) @@ -254,8 +255,10 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) * conversion in assignement is by definition greater than all * values of size_t, including old i->count. */ - if (i->count > count) + if (i->count > count) { + i->truncated += i->count - count; i->count = count; + } } /* @@ -264,6 +267,7 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) */ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) { + i->truncated -= count - i->count; i->count = count; } |