]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring: add lockdep asserts to io_add_aux_cqe
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 9 May 2025 11:03:43 +0000 (12:03 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 May 2025 13:58:55 +0000 (07:58 -0600)
io_add_aux_cqe() can only be called for rings with uring_lock protected
completion queues, add a couple of assertions in regards to that.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c010eab7b94a187c00a9d46d8b67bf7fcad18af4.1746788592.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c

index 0d051476008c70c6e93b36a3db49c8baf9eb58a8..4034b1db7135a0c98a24df7c5eb85aab88f8133b 100644 (file)
@@ -848,6 +848,9 @@ bool io_post_aux_cqe(struct io_ring_ctx *ctx, u64 user_data, s32 res, u32 cflags
  */
 void io_add_aux_cqe(struct io_ring_ctx *ctx, u64 user_data, s32 res, u32 cflags)
 {
+       lockdep_assert_held(&ctx->uring_lock);
+       lockdep_assert(ctx->lockless_cq);
+
        if (!io_fill_cqe_aux(ctx, user_data, res, cflags)) {
                spin_lock(&ctx->completion_lock);
                io_cqring_event_overflow(ctx, user_data, res, cflags, 0, 0);