Skip to content

Commit 87ceb6a

Browse files
committed
io_uring: drop 'ctx' ref on task work cancelation
If task_work ends up being marked for cancelation, we go through a cancelation helper instead of the queue path. In converting task_work to always hold a ctx reference, this path was missed. Make sure that io_req_task_cancel() puts the reference that is being held against the ctx. Fixes: 6d816e0 ("io_uring: hold 'ctx' reference around task_work queue + execute") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 202700e commit 87ceb6a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/io_uring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,8 +1787,10 @@ static void __io_req_task_cancel(struct io_kiocb *req, int error)
17871787
static void io_req_task_cancel(struct callback_head *cb)
17881788
{
17891789
struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
1790+
struct io_ring_ctx *ctx = req->ctx;
17901791

17911792
__io_req_task_cancel(req, -ECANCELED);
1793+
percpu_ref_put(&ctx->refs);
17921794
}
17931795

17941796
static void __io_req_task_submit(struct io_kiocb *req)

0 commit comments

Comments
 (0)