]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
io_uring/poll: fix multishot recv missing EOF on wakeup race
authorJens Axboe <axboe@kernel.dk>
Sun, 15 Mar 2026 15:03:03 +0000 (09:03 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 17 Mar 2026 19:54:08 +0000 (13:54 -0600)
commita68ed2df72131447d131531a08fe4dfcf4fa4653
treec3e72484af4e181faf2823aa773dd26f51f03d00
parentc2c185be5c85d37215397c8e8781abf0a69bec1f
io_uring/poll: fix multishot recv missing EOF on wakeup race

When a socket send and shutdown() happen back-to-back, both fire
wake-ups before the receiver's task_work has a chance to run. The first
wake gets poll ownership (poll_refs=1), and the second bumps it to 2.
When io_poll_check_events() runs, it calls io_poll_issue() which does a
recv that reads the data and returns IOU_RETRY. The loop then drains all
accumulated refs (atomic_sub_return(2) -> 0) and exits, even though only
the first event was consumed. Since the shutdown is a persistent state
change, no further wakeups will happen, and the multishot recv can hang
forever.

Check specifically for HUP in the poll loop, and ensure that another
loop is done to check for status if more than a single poll activation
is pending. This ensures we don't lose the shutdown event.

Cc: stable@vger.kernel.org
Fixes: dbc2564cfe0f ("io_uring: let fast poll support multishot")
Reported-by: Francis Brosseau <francis@malagauche.com>
Link: https://github.com/axboe/liburing/issues/1549
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/poll.c