]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: zero iocb->ki_pos for stream file types
authorJens Axboe <axboe@kernel.dk>
Thu, 23 Dec 2021 03:26:56 +0000 (20:26 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 Dec 2021 03:34:32 +0000 (20:34 -0700)
commitae9a63c5c4fe165b7b29655be70177abff71d854
tree558a1ea956f6cfe20044a9f63364f74529dbc122
parent4647a42469a1973b54b3b604cc1274a5d6291a6e
io_uring: zero iocb->ki_pos for stream file types

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: 51e92a35806f ("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>
fs/io_uring.c