diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c index a49ccab262d5..7d5b544cfc30 100644 --- a/io_uring/msg_ring.c +++ b/io_uring/msg_ring.c @@ -30,6 +30,8 @@ static int io_msg_ring_data(struct io_kiocb *req) if (msg->src_fd || msg->dst_fd || msg->flags) return -EINVAL; + if (target_ctx->flags & IORING_SETUP_R_DISABLED) + return -EBADFD; if (io_post_aux_cqe(target_ctx, msg->user_data, msg->len, 0, true)) return 0; @@ -84,6 +86,8 @@ static int io_msg_send_fd(struct io_kiocb *req, unsigned int issue_flags) if (target_ctx == ctx) return -EINVAL; + if (target_ctx->flags & IORING_SETUP_R_DISABLED) + return -EBADFD; ret = io_double_lock_ctx(ctx, target_ctx, issue_flags); if (unlikely(ret))