提交 49b4c8f8 编写于 作者: J Jens Axboe 提交者: sanglipeng

io_uring/io-wq: only free worker if it was allocated for creation

stable inclusion
from stable-v5.10.164
commit a88a0d16e18f18d7221f0c5a1fdf487f5f9079e3
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7T7G4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a88a0d16e18f18d7221f0c5a1fdf487f5f9079e3

--------------------------------

commit e6db6f93 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: af82425c ("io_uring/io-wq: free worker if task_work creation is canceled")
Reported-by: syzbot+d56ec896af3637bdb7e4@syzkaller.appspotmail.com
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 ecce3494
...@@ -1217,7 +1217,12 @@ static void io_wq_cancel_tw_create(struct io_wq *wq) ...@@ -1217,7 +1217,12 @@ static void io_wq_cancel_tw_create(struct io_wq *wq)
worker = container_of(cb, struct io_worker, create_work); worker = container_of(cb, struct io_worker, create_work);
io_worker_cancel_cb(worker); 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);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册