Jens Axboe 20fb0dc35b io_uring: zero iocb->ki_pos for stream file types
[ Upstream commit 7b9762a5e8837b92a027d58d396a9d27f6440c36 ]

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: ba04291eb66e ("io_uring: allow use of offset == -1 to mean file position")
Link: https://github.com/axboe/liburing/discussions/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>
2021-12-29 12:28:45 +01:00
..
2021-12-22 09:32:45 +01:00
2021-08-19 09:02:55 +09:00
2021-04-12 15:04:29 +02:00
2021-09-02 12:32:12 -07:00
2021-08-26 22:28:02 +02:00
2021-11-18 19:16:48 +01:00
2021-09-22 09:21:02 -07:00
2021-12-29 12:28:38 +01:00
2021-09-10 09:46:48 -07:00
2021-06-29 10:53:48 -07:00
2021-09-03 15:33:47 -07:00
2021-08-16 10:50:32 -06:00
2021-11-25 09:48:46 +01:00
2021-08-19 09:02:55 +09:00
2021-09-09 11:39:57 -07:00
2021-12-22 09:32:48 +01:00
2021-11-25 09:48:46 +01:00
2021-08-31 11:13:35 -07:00
2021-09-09 13:25:49 -07:00
2021-11-25 09:49:08 +01:00
2021-08-31 11:06:32 -07:00
2021-06-29 10:53:48 -07:00
2021-08-18 22:08:24 +02:00
2021-12-14 10:57:15 +01:00
2021-08-10 17:57:22 +02:00