task_work fallback is executed from a workqueue, so current and req->task are not necessarily the same. It's still safe to poke into it as the request holds a task_struct reference. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- io_uring/io_uring.c | 2 +- io_uring/poll.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 94329c1ce91d..5a8a43fb6750 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1249,7 +1249,7 @@ static void io_req_task_cancel(struct io_kiocb *req, bool *locked) void io_req_task_submit(struct io_kiocb *req, bool *locked) { io_tw_lock(req->ctx, locked); - /* req->task == current here, checking PF_EXITING is safe */ + if (likely(!(req->task->flags & PF_EXITING))) io_queue_sqe(req); else diff --git a/io_uring/poll.c b/io_uring/poll.c index 2830b7daf952..5d4a0a4a379a 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -214,7 +214,6 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked) struct io_ring_ctx *ctx = req->ctx; int v, ret; - /* req->task == current here, checking PF_EXITING is safe */ if (unlikely(req->task->flags & PF_EXITING)) return -ECANCELED; -- 2.38.1