summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2024-11-11 18:13:18 +0800
committerJens Axboe <axboe@kernel.dk>2024-11-11 08:11:37 -0700
commita43e236fb9aef4528f2bd24095d1f348030f5d9d (patch)
treeebae170671ba3a9407d0ac3fa88dcab98ffe9b6d /io_uring
parent039c878db7add23c1c9ea18424c442cce76670f9 (diff)
io_uring/uring_cmd: fix buffer index retrieval
Add back buffer index retrieval for IORING_URING_CMD_FIXED. Reported-by: Guangwu Zhang <guazhang@redhat.com> Cc: Jeff Moyer <jmoyer@redhat.com> Fixes: b54a14041ee6 ("io_uring/rsrc: add io_rsrc_node_lookup() helper") Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Kanchan Joshi <joshi.k@samsung.com> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Tested-by: Guangwu Zhang <guazhang@redhat.com> Link: https://lore.kernel.org/r/20241111101318.1387557-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/uring_cmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index b62965f58f30..e9d99d3ecc34 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -210,8 +210,9 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
if (ioucmd->flags & IORING_URING_CMD_FIXED) {
struct io_ring_ctx *ctx = req->ctx;
struct io_rsrc_node *node;
+ u16 index = READ_ONCE(sqe->buf_index);
- node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index);
+ node = io_rsrc_node_lookup(&ctx->buf_table, index);
if (unlikely(!node))
return -EFAULT;
/*