Commit 934447a6 authored by Dylan Yudaken's avatar Dylan Yudaken Committed by Jens Axboe
Browse files

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: default avatarAmmar Faizi <ammarfaizi2@gnuweeb.org>
Fixes: b66e65f4 ("io_uring: never call io_buffer_select() for a buffer re-select")
Signed-off-by: default avatarDylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220721131325.624788-1-dylany@fb.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ec8516f3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1737,6 +1737,14 @@ static void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
	    (req->flags & REQ_F_PARTIAL_IO))
		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.