From: Jens Axboe Date: Fri, 15 Jan 2021 23:04:23 +0000 (-0700) Subject: io_uring: ensure finish_wait() is always called in __io_uring_task_cancel() X-Git-Tag: baikal/aarch64/sdk6.1~7459^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=ce70c0f9b472a910cb22b177e904d6f7cbd0d194;p=kernel.git io_uring: ensure finish_wait() is always called in __io_uring_task_cancel() If we enter with requests pending and performm cancelations, we'll have a different inflight count before and after calling prepare_to_wait(). This causes the loop to restart. If we actually ended up canceling everything, or everything completed in-between, then we'll break out of the loop without calling finish_wait() on the waitqueue. This can trigger a warning on exit_signals(), as we leave the task state in TASK_UNINTERRUPTIBLE. Put a finish_wait() after the loop to catch that case. Cc: stable@vger.kernel.org # 5.9+ Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 06cc79d39586d..985a9e3f976d3 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9101,6 +9101,7 @@ void __io_uring_task_cancel(void) finish_wait(&tctx->wait, &wait); } while (1); + finish_wait(&tctx->wait, &wait); atomic_dec(&tctx->in_idle); io_uring_remove_task_files(tctx);