Skip to contentSkip to conversation

io_uring/rw: ensure allocated iovec gets cleared for early failure

PATCH New Jens Axboe 1 participant 1 message Nov 10, 2025 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/rw: ensure allocated iovec gets cleared for early failure

A previous commit reused the recyling infrastructure for early cleanup, but this is not enough for the case where our internal caches have overflowed. If this happens, then the allocated iovec can get leaked if the request is also aborted early.

Reinstate the previous forced free of the iovec for that situation.

Reported-by [email protected]
Fixes 9ac273ae3dc2 ("io_uring/rw: use io_rw_recycle() from cleanup path")

---

io_uring/rw.c +3 -0
index 5b2241a5813c..abe68ba9c9dc 100644
@@ -463,7 +463,10 @@ int io_read_mshot_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 
 void io_readv_writev_cleanup(struct io_kiocb *req)
 {
+	struct io_async_rw *rw = req->async_data;
+
 	lockdep_assert_held(&req->ctx->uring_lock);
+	io_vec_free(&rw->vec);
 	io_rw_recycle(req, 0);
 }
 
Signature · 1 line
Jens Axboe