From 42a9b5f649124761a4ffd260d267295056eea113 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 May 2023 08:23:32 -0600 Subject: [PATCH 1/3] io_uring: always grab lock in io_cancel_async_work() No upstream commit exists for this patch. It's not necessarily safe to check the task_list locklessly, remove this micro optimization and always grab task_lock before deeming it empty. Reported-and-tested-by: Lee Jones Signed-off-by: Jens Axboe --- fs/io_uring.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index e8df6345a812..cc4b6635068a 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3738,9 +3738,6 @@ static void io_cancel_async_work(struct io_ring_ctx *ctx, { struct io_kiocb *req; - if (list_empty(&ctx->task_list)) - return; - spin_lock_irq(&ctx->task_lock); list_for_each_entry(req, &ctx->task_list, task_list) { -- 2.39.2