summaryrefslogtreecommitdiff
path: root/io_uring/poll.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2025-01-30 08:40:29 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-17 09:40:36 +0100
commit130675a21942d60cb53bfc9e39ca4833e16b1182 (patch)
tree6c402ecdd03e0a707ec76932bc66ac32a62aaf36 /io_uring/poll.c
parentb86f1d51731e621e83305dc9564ae14c9ef752bf (diff)
downloadlinux-130675a21942d60cb53bfc9e39ca4833e16b1182.tar.gz
linux-130675a21942d60cb53bfc9e39ca4833e16b1182.tar.bz2
linux-130675a21942d60cb53bfc9e39ca4833e16b1182.zip
io_uring/net: don't retry connect operation on EPOLLERR
commit 8c8492ca64e79c6e0f433e8c9d2bcbd039ef83d0 upstream. If a socket is shutdown before the connection completes, POLLERR is set in the poll mask. However, connect ignores this as it doesn't know, and attempts the connection again. This may lead to a bogus -ETIMEDOUT result, where it should have noticed the POLLERR and just returned -ECONNRESET instead. Have the poll logic check for whether or not POLLERR is set in the mask, and if so, mark the request as failed. Then connect can appropriately fail the request rather than retry it. Reported-by: Sergey Galas <ssgalas@cloud.ru> Cc: stable@vger.kernel.org Link: https://github.com/axboe/liburing/discussions/1335 Fixes: 3fb1bd688172 ("io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT") 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, 2 insertions, 0 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c
index 2824a3560245..cf8e86bc96de 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -308,6 +308,8 @@ static int io_poll_check_events(struct io_kiocb *req, struct io_tw_state *ts)
return IOU_POLL_REISSUE;
}
}
+ if (unlikely(req->cqe.res & EPOLLERR))
+ req_set_fail(req);
if (req->apoll_events & EPOLLONESHOT)
return IOU_POLL_DONE;