diff mbox series

[1/7] io_uring/kbuf: mark buf_sel_arg mode as KBUF_MODE_FREE once allocated

Message ID 20241023161522.1126423-2-axboe@kernel.dk (mailing list archive)
State New
Headers show
Series Add support for provided registered buffers | expand

Commit Message

Jens Axboe Oct. 23, 2024, 4:07 p.m. UTC
If kbuf expands the iovec array, then it doesn't matter if the caller
didn't set KBUF_MODE_FREE or not, as once allocated it should be marked
as such. Ensure that this is the case.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/kbuf.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index d407576ddfb7..1318b8ee2599 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -245,6 +245,7 @@  static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
 			kfree(arg->iovs);
 		arg->iovs = iov;
 		nr_iovs = nr_avail;
+		arg->mode |= KBUF_MODE_FREE;
 	} else if (nr_avail < nr_iovs) {
 		nr_iovs = nr_avail;
 	}