From: Yichong Chen <chenyichong@uniontech.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Cc: Pavel Begunkov <asml.silence@gmail.com>,
linux-kernel@vger.kernel.org,
Yichong Chen <chenyichong@uniontech.com>
Subject: [PATCH] io_uring/poll: don't lose the error of a failed poll update
Date: Thu, 19 Nov 2026 15:44:36 +0800 [thread overview]
Message-ID: <20261119074436.1137704-1-chenyichong@uniontech.com> (raw)
A poll update rearms the poll request it is updating, and io_poll_add()
can fail with a negative error when the file registers a third wait
queue or when the second poll entry cannot be allocated. That case falls
through to the -ECANCELED completion that is meant for a plain
POLL_REMOVE, so the poll request completes with the wrong error and the
update reports success. Complete both with that error instead.
Fixes: 97b388d70b53 ("io_uring: handle completions in the core")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
---
io_uring/poll.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/io_uring/poll.c b/io_uring/poll.c
index fc1800c..c2955c1 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -1031,6 +1031,9 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags)
/* request completed as part of the update, complete it */
else if (ret2 == IOU_COMPLETE)
goto complete;
+ ret = ret2;
+ io_req_set_res(preq, ret2, 0);
+ goto complete;
}
io_req_set_res(preq, -ECANCELED, 0);
--
2.51.0
reply other threads:[~2026-11-19 7:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119074436.1137704-1-chenyichong@uniontech.com \
--to=chenyichong@uniontech.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®