diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c index 81b5e4462dba4b819aab4458a1185cf5010484ef..87bc38b4710376afbc016c58d3370ca77f844dd3 100644 --- a/io_uring/io-wq.c +++ b/io_uring/io-wq.c @@ -1217,7 +1217,12 @@ static void io_wq_cancel_tw_create(struct io_wq *wq) 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); } }