io_uring: fix task leak issue in io_wq_create()
authorPenglei Jiang <superman.xpt@gmail.com>
Sun, 15 Jun 2025 16:39:06 +0000 (09:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Sun, 15 Jun 2025 18:58:39 +0000 (12:58 -0600)
Add missing put_task_struct() in the error path

Cc: stable@vger.kernel.org
Fixes: 0f8baa3c9802 ("io-wq: fully initialize wqe before calling cpuhp_state_add_instance_nocalls()")
Signed-off-by: Penglei Jiang <superman.xpt@gmail.com>
Link: https://lore.kernel.org/r/20250615163906.2367-1-superman.xpt@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io-wq.c

index cd1fcb115739a8fe851b87f1c6dca92a475b42a8..be91edf34f01374b56b29e815fad8771ae446ad8 100644 (file)
@@ -1259,8 +1259,10 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
        atomic_set(&wq->worker_refs, 1);
        init_completion(&wq->worker_done);
        ret = cpuhp_state_add_instance_nocalls(io_wq_online, &wq->cpuhp_node);
-       if (ret)
+       if (ret) {
+               put_task_struct(wq->task);
                goto err;
+       }
 
        return wq;
 err: