From ce6a504d69415bea03c8ac3048f8476cafbaf0df Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 May 2023 08:23:32 -0600 Subject: [PATCH] UPSTREAM: 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. Bug: 278721720 Reported-and-tested-by: Lee Jones Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman (cherry picked from commit b0bfceaa8c0e164541af1a28e85b575a1cd4ef91) Signed-off-by: Lee Jones Change-Id: I112708bdbe43f0e1c2cad5e73a56d7609c10d339 --- fs/io_uring.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index b63f5c37fd17..8e8022e6eb6e 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3735,9 +3735,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) {