diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index cb54ebda0a8a..8ecf01f1b689 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -7366,6 +7366,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, return -EINVAL; if (unlikely(req->opcode >= IORING_OP_LAST)) return -EINVAL; + req->opcode = array_index_nospec(req->opcode, IORING_OP_LAST); + if (!io_check_restriction(ctx, req, sqe_flags)) return -EACCES;