summaryrefslogtreecommitdiffstats
path: root/io_uring/net.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-10-27 16:08:31 +0100
committerJens Axboe <axboe@kernel.dk>2024-11-02 22:45:30 +0100
commitb54a14041ee6444692d95ff38c8b3d1af682aa17 (patch)
tree658c5839cb2eb6dd19429c5e4911ea9cd727d664 /io_uring/net.c
parentio_uring/rsrc: unify file and buffer resource tables (diff)
downloadlinux-b54a14041ee6444692d95ff38c8b3d1af682aa17.tar.xz
linux-b54a14041ee6444692d95ff38c8b3d1af682aa17.zip
io_uring/rsrc: add io_rsrc_node_lookup() helper
There are lots of spots open-coding this functionality, add a generic helper that does the node lookup in a speculation safe way. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/net.c')
-rw-r--r--io_uring/net.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index 3e1f31574abb..2f7b334ed708 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1343,13 +1343,11 @@ static int io_send_zc_import(struct io_kiocb *req, unsigned int issue_flags)
if (sr->flags & IORING_RECVSEND_FIXED_BUF) {
struct io_ring_ctx *ctx = req->ctx;
struct io_rsrc_node *node;
- int idx;
ret = -EFAULT;
io_ring_submit_lock(ctx, issue_flags);
- if (sr->buf_index < ctx->buf_table.nr) {
- idx = array_index_nospec(sr->buf_index, ctx->buf_table.nr);
- node = ctx->buf_table.nodes[idx];
+ node = io_rsrc_node_lookup(&ctx->buf_table, sr->buf_index);
+ if (node) {
io_req_assign_rsrc_node(sr->notif, node);
ret = 0;
}