Commit 20fb0dc
io_uring: zero iocb->ki_pos for stream file types
[ Upstream commit 7b9762a ]
io_uring supports using offset == -1 for using the current file position,
and we read that in as part of read/write command setup. For the non-iter
read/write types we pass in NULL for the position pointer, but for the
iter types we should not be passing any anything but 0 for the position
for a stream.
Clear kiocb->ki_pos if the file is a stream, don't leave it as -1. If we
do, then the request will error with -ESPIPE.
Fixes: ba04291 ("io_uring: allow use of offset == -1 to mean file position")
Link: axboe/liburing#501
Reported-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 5cf0397 commit 20fb0dc
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2879 | 2879 | | |
2880 | 2880 | | |
2881 | 2881 | | |
2882 | | - | |
2883 | | - | |
2884 | | - | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
2885 | 2889 | | |
2886 | 2890 | | |
2887 | 2891 | | |
| |||
0 commit comments