]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring: silence false positive warnings
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 7 Jan 2025 14:11:32 +0000 (14:11 +0000)
committerJens Axboe <axboe@kernel.dk>
Tue, 7 Jan 2025 14:19:44 +0000 (07:19 -0700)
If we kill a ring and then immediately exit the task, we'll get
cancellattion running by the task and a kthread in io_ring_exit_work.
For DEFER_TASKRUN, we do want to limit it to only one entity executing
it, however it's currently not an issue as it's protected by uring_lock.

Silence lockdep assertions for now, we'll return to it later.

Reported-by: syzbot+1bcb75613069ad4957fc@syzkaller.appspotmail.com
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7e5f68281acb0f081f65fde435833c68a3b7e02f.1736257837.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.h

index 12abee607e4aa245257e0b70ded3642341c87d4a..492cbbf2c23b773f3e33ab41e08b1eedef33209a 100644 (file)
@@ -125,6 +125,9 @@ static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
 #if defined(CONFIG_PROVE_LOCKING)
        lockdep_assert(in_task());
 
+       if (ctx->flags & IORING_SETUP_DEFER_TASKRUN)
+               lockdep_assert_held(&ctx->uring_lock);
+
        if (ctx->flags & IORING_SETUP_IOPOLL) {
                lockdep_assert_held(&ctx->uring_lock);
        } else if (!ctx->task_complete) {
@@ -136,9 +139,7 @@ static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
                 * Not from an SQE, as those cannot be submitted, but via
                 * updating tagged resources.
                 */
-               if (percpu_ref_is_dying(&ctx->refs))
-                       lockdep_assert(current_work());
-               else
+               if (!percpu_ref_is_dying(&ctx->refs))
                        lockdep_assert(current == ctx->submitter_task);
        }
 #endif