diff options
| author | 2026-10-18 14:17:08 +0900 | |
|---|---|---|
| committer | 2026-10-30 15:56:02 +0100 | |
| commit | 79b496ebe382866e3a05090b7dc9ae95e85e65b2 (patch) | |
| tree | 8b37602f7a47d8a6a37f3e880749a37cc6a74df8 /scripts/Makefile.thinlto | |
| parent | backing-file: always end a queued write (diff) | |
splice: avoid stale f_pos writeback on error
do_splice() snapshots an implicit file position before calling the splice
helper. Since splice does not take f_pos_lock, another operation on the
same open file description can update f_pos while the helper is blocked.
If the helper then fails, the unconditional writeback restores the stale
snapshot.
For a directory without ->splice_read, a file-to-pipe splice fails with
-EINVAL. A concurrent directory mutation and getdents() call can advance
f_pos and refresh the filesystem's revalidation cookie before that failure
restores only the old position. The next ext2 readdir can then trust an
offset inside a directory entry and copy data from the adjacent page to
userspace.
Only update an implicit file position when splice returns a non-negative
result, matching read and write. Keep explicit offset updates unchanged.
Fixes: 7995bd287134 ("splice: don't pass the address of ->f_pos to methods")
Cc: stable@vger.kernel.org
Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>
Link: https://patch.msgid.link/20261018051708.2422394-1-4ncienth@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
