aboutsummaryrefslogtreecommitdiffstats
path: root/io_uring/net.c
diff options
context:
space:
mode:
authorPavel Begunkov <[email protected]>2025-03-07 16:00:37 +0000
committerJens Axboe <[email protected]>2025-03-07 20:41:08 +0000
commit0396ad3766ad4879b35c5401cee41bba64fe75d2 (patch)
treed43c78a1de1140abbb4527d489d34d79f0469176 /io_uring/net.c
parentio_uring/net: implement vectored reg bufs for zctx (diff)
downloadkernel-0396ad3766ad4879b35c5401cee41bba64fe75d2.tar.gz
kernel-0396ad3766ad4879b35c5401cee41bba64fe75d2.zip
io_uring: cap cached iovec/bvec size
Bvecs can be large, put an arbitrary limit on the max vector size it can cache. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/823055fa6628daa24bbc9cd77c2da87e9a1e1e32.1741362889.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'io_uring/net.c')
-rw-r--r--io_uring/net.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index 40ecf421798f..34a28689ec99 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -152,6 +152,9 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags)
/* Let normal cleanup path reap it if we fail adding to the cache */
io_alloc_cache_vec_kasan(&hdr->vec);
+ if (hdr->vec.nr > IO_VEC_CACHE_SOFT_CAP)
+ io_vec_free(&hdr->vec);
+
if (io_alloc_cache_put(&req->ctx->netmsg_cache, hdr)) {
req->async_data = NULL;
req->flags &= ~REQ_F_ASYNC_DATA;