io_uring/io-wq: only free worker if it was allocated for creation
authorJens Axboe <axboe@kernel.dk>
Sun, 8 Jan 2023 17:39:17 +0000 (10:39 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:48:58 +0000 (11:48 +0100)
commitba86db02d408ae362ee5f1cde52ffafb37b41ce5
tree5245705dac0dc3a4c727a874fccb7cf5b35e2da9
parentbb135bcc949980e96abd57d7bbeb40d69d380e0c
io_uring/io-wq: only free worker if it was allocated for creation

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@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io-wq.c