diff options
| author | Cheng Yongkang <teel4res@gmail.com> | 2026-10-29 07:12:20 -0700 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-11-11 11:59:07 +0100 |
| commit | 2d956723e82cddae8ff8e9da99a666217b02065f (patch) | |
| tree | 11129dcd16267909c37f736900928c8d6af25af2 /include/linux | |
| parent | fbdc020ee1b82079102e493aaa7200de5f497a38 (diff) | |
fs/splice: clamp an over-reported write_iter result
iter_file_splice_write() builds a bvec iterator of at most
sd.total_len - left bytes and passes it to ->write_iter(). It then
subtracts the returned length from sd.total_len and walks the pipe
buffers by that length. A ->write_iter() implementation that reports
more bytes than the iterator held makes sd.total_len underflow and the
dismissal loop advance pipe->tail past pipe->head, releasing a zeroed
pipe buffer:
Splice Exceeded! ret=7 tot=1 left=0
Oops: general protection fault
RIP: 0010:iter_file_splice_write+0xb6f/0x1170
Commit a3de58b12ce0 ("netfs: Fix unbuffered write error handling")
added the warning for this condition but only reports it. Clamp the
return value to the size of the iterator that was actually handed to
->write_iter(), so the pipe accounting stays consistent even when a
producer violates the iterator contract.
Fixes: 8d0207652cbe ("->splice_write() via ->write_iter()")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/179328314072.648427.13388575162083843840@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
