diff options
| author | Stephen Rothwell <sfr@canb.auug.org.au> | 2022-06-28 08:56:29 +1000 |
|---|---|---|
| committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2022-06-28 08:56:29 +1000 |
| commit | 23cb3242bb13c16e797381fe0b28f32a87b7fecc (patch) | |
| tree | 8a09f8a2dc957dc1a41c36a72959938979b84c4d /lib | |
| parent | cc23364ddb463436c80e8b753c830e93e194b4a3 (diff) | |
| parent | 1c7c0f168f97db2bf9c1ad9c16b387d6ab66e323 (diff) | |
| download | linux-next-23cb3242bb13c16e797381fe0b28f32a87b7fecc.tar.gz linux-next-23cb3242bb13c16e797381fe0b28f32a87b7fecc.zip | |
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/iov_iter.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 0b64695ab632..2bf20b48a04a 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -689,6 +689,7 @@ static size_t copy_mc_pipe_to_iter(const void *addr, size_t bytes, struct pipe_inode_info *pipe = i->pipe; unsigned int p_mask = pipe->ring_size - 1; unsigned int i_head; + unsigned int valid = pipe->head; size_t n, off, xfer = 0; if (!sanity(i)) @@ -702,11 +703,17 @@ static size_t copy_mc_pipe_to_iter(const void *addr, size_t bytes, rem = copy_mc_to_kernel(p + off, addr + xfer, chunk); chunk -= rem; kunmap_local(p); - i->head = i_head; - i->iov_offset = off + chunk; - xfer += chunk; - if (rem) + if (chunk) { + i->head = i_head; + i->iov_offset = off + chunk; + xfer += chunk; + valid = i_head + 1; + } + if (rem) { + pipe->bufs[i_head & p_mask].len -= rem; + pipe_discard_from(pipe, valid); break; + } n -= chunk; off = 0; i_head++; |
