Skip to content
Snippets Groups Projects
Commit 61672e4c authored by Jens Axboe's avatar Jens Axboe Committed by Greg Kroah-Hartman
Browse files

UPSTREAM: io_uring: don't gate task_work run on TIF_NOTIFY_SIGNAL


commit 46a525e1 upstream.

This isn't a reliable mechanism to tell if we have task_work pending, we
really should be looking at whether we have any items queued. This is
problematic if forward progress is gated on running said task_work. One
such example is reading from a pipe, where the write side has been closed
right before the read is started. The fput() of the file queues TWA_RESUME
task_work, and we need that task_work to be run before ->release() is
called for the pipe. If ->release() isn't called, then the read will sit
forever waiting on data that will never arise.

Fix this by io_run_task_work() so it checks if we have task_work pending
rather than rely on TIF_NOTIFY_SIGNAL for that. The latter obviously
doesn't work for task_work that is queued without TWA_SIGNAL.

Reported-by: default avatarChristiano Haesbaert <haesbaert@haesbaert.org>
Cc: stable@vger.kernel.org
Link: https://github.com/axboe/liburing/issues/665


Change-Id: I042b07491afac06692639d91bdf7dd21a2405651
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Bug: 268174392
(cherry picked from commit 2fd232bb)
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent f45e8d63
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment