[PATCH][next] io_uring: Fix incorrect ordering of assinments of sqe and opcode

Colin Ian King posted 1 patch 3 months, 2 weeks ago
io_uring/fdinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH][next] io_uring: Fix incorrect ordering of assinments of sqe and opcode
Posted by Colin Ian King 3 months, 2 weeks ago
Currently opcode is being assigned to a dereferenced pointer sqe before
sqe is being assigned. It appears the order of these two assignments cs
the wrong way around. Fix this by swapping the order of the assignments.

Fixes: 31dc41afdef2 ("io_uring: add support for IORING_SETUP_SQE_MIXED")

Signed-off-by: Colin Ian King <coking@nvidia.com>
---
 io_uring/fdinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index d5aa64203de5..5b26b2a97e1b 100644
--- a/io_uring/fdinfo.c
+++ b/io_uring/fdinfo.c
@@ -100,8 +100,8 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
 		if (sq_idx > sq_mask)
 			continue;
 
-		opcode = READ_ONCE(sqe->opcode);
 		sqe = &ctx->sq_sqes[sq_idx << sq_shift];
+		opcode = READ_ONCE(sqe->opcode);
 		if (sq_shift) {
 			sqe128 = true;
 		} else if (io_issue_defs[opcode].is_128) {
-- 
2.51.0
Re: [PATCH][next] io_uring: Fix incorrect ordering of assinments of sqe and opcode
Posted by Jens Axboe 3 months, 2 weeks ago
On 10/22/25 7:44 AM, Colin Ian King wrote:
> Currently opcode is being assigned to a dereferenced pointer sqe before
> sqe is being assigned. It appears the order of these two assignments cs
> the wrong way around. Fix this by swapping the order of the assignments.

Fix for this has already been folded in.

-- 
Jens Axboe