This is a note to let you know that I've just added the patch titled io_uring/io-wq: only free worker if it was allocated for creation to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-io-wq-only-free-worker-if-it-was-allocated-for-creation.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e6db6f9398dadcbc06318a133d4c44a2d3844e61 Mon Sep 17 00:00:00 2001 From: Jens Axboe <axboe@xxxxxxxxx> Date: Sun, 8 Jan 2023 10:39:17 -0700 Subject: io_uring/io-wq: only free worker if it was allocated for creation From: Jens Axboe <axboe@xxxxxxxxx> commit e6db6f9398dadcbc06318a133d4c44a2d3844e61 upstream. We have two types of task_work based creation, one is using an existing worker to setup a new one (eg when going to sleep and we have no free workers), and the other is allocating a new worker. Only the latter should be freed when we cancel task_work creation for a new worker. Fixes: af82425c6a2d ("io_uring/io-wq: free worker if task_work creation is canceled") Reported-by: syzbot+d56ec896af3637bdb7e4@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- io_uring/io-wq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/io_uring/io-wq.c +++ b/io_uring/io-wq.c @@ -1230,7 +1230,12 @@ static void io_wq_cancel_tw_create(struc worker = container_of(cb, struct io_worker, create_work); io_worker_cancel_cb(worker); - kfree(worker); + /* + * Only the worker continuation helper has worker allocated and + * hence needs freeing. + */ + if (cb->func == create_worker_cont) + kfree(worker); } } Patches currently in stable-queue which might be from axboe@xxxxxxxxx are queue-6.1/block-handle-bio_split_to_limits-null-return.patch queue-6.1/io_uring-poll-attempt-request-issue-after-racy-poll-.patch queue-6.1/io_uring-io-wq-only-free-worker-if-it-was-allocated-for-creation.patch queue-6.1/blk-crypto-pass-a-gendisk-to-blk_crypto_sysfs_-un-re.patch queue-6.1/block-drop-spurious-might_sleep-from-blk_put_queue.patch queue-6.1/block-mark-blk_put_queue-as-potentially-blocking.patch queue-6.1/io_uring-fdinfo-include-locked-hash-table-in-fdinfo-output.patch queue-6.1/block-factor-out-a-blk_debugfs_remove-helper.patch queue-6.1/block-fix-error-unwinding-in-blk_register_queue.patch queue-6.1/io_uring-poll-add-hash-if-ready-poll-request-can-t-complete-inline.patch queue-6.1/block-untangle-request_queue-refcounting-from-sysfs.patch queue-6.1/io_uring-lock-overflowing-for-iopoll.patch queue-6.1/io_uring-io-wq-free-worker-if-task_work-creation-is-canceled.patch queue-6.1/blk-mq-move-the-srcu_struct-used-for-quiescing-to-th.patch