summaryrefslogtreecommitdiff
path: root/io_uring/poll.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2025-09-18 10:21:14 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-09-25 11:13:47 +0200
commite6b2b4a0ffd856b5f0291b14ccd2f83319c15ef8 (patch)
tree943340b34fc9fba3d71be5a758bdacadfab7128b /io_uring/poll.c
parentd7a38ee4f0be96737c39a931b7f9cdc7f42b6913 (diff)
downloadlinux-e6b2b4a0ffd856b5f0291b14ccd2f83319c15ef8.tar.gz
linux-e6b2b4a0ffd856b5f0291b14ccd2f83319c15ef8.tar.bz2
linux-e6b2b4a0ffd856b5f0291b14ccd2f83319c15ef8.zip
io_uring: include dying ring in task_work "should cancel" state
Commit 3539b1467e94336d5854ebf976d9627bfb65d6c3 upstream. When running task_work for an exiting task, rather than perform the issue retry attempt, the task_work is canceled. However, this isn't done for a ring that has been closed. This can lead to requests being successfully completed post the ring being closed, which is somewhat confusing and surprising to an application. Rather than just check the task exit state, also include the ring ref state in deciding whether or not to terminate a given request when run from task_work. Cc: stable@vger.kernel.org # 6.1+ Link: https://github.com/axboe/liburing/discussions/1459 Reported-by: Benedek Thaler <thaler@thaler.hu> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring/poll.c')
-rw-r--r--io_uring/poll.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c
index a12ac9453606..bfdb537572f7 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -265,7 +265,7 @@ static int io_poll_check_events(struct io_kiocb *req, struct io_tw_state *ts)
{
int v;
- if (unlikely(io_should_terminate_tw()))
+ if (unlikely(io_should_terminate_tw(req->ctx)))
return -ECANCELED;
do {