summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDylan Yudaken <dylany@fb.com>2022-07-21 15:13:25 +0200
committerJens Axboe <axboe@kernel.dk>2022-07-21 16:31:31 +0200
commit934447a603b22d98f45a679115d8402e1efdd0f7 (patch)
tree6beef5e7c0e18839d1564e00e61f0e8d074783b2 /fs
parentio_uring: fix free of unallocated buffer list (diff)
downloadlinux-934447a603b22d98f45a679115d8402e1efdd0f7.tar.xz
linux-934447a603b22d98f45a679115d8402e1efdd0f7.zip
io_uring: do not recycle buffer in READV
READV cannot recycle buffers as it would lose some of the data required to reimport that buffer. Reported-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Fixes: b66e65f41426 ("io_uring: never call io_buffer_select() for a buffer re-select") Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220721131325.624788-1-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 2b7bb62c7805..e8e769be9ed0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1738,6 +1738,14 @@ static void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
return;
/*
+ * READV uses fields in `struct io_rw` (len/addr) to stash the selected
+ * buffer data. However if that buffer is recycled the original request
+ * data stored in addr is lost. Therefore forbid recycling for now.
+ */
+ if (req->opcode == IORING_OP_READV)
+ return;
+
+ /*
* We don't need to recycle for REQ_F_BUFFER_RING, we can just clear
* the flag and hence ensure that bl->head doesn't get incremented.
* If the tail has already been incremented, hang on to it.