mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] io_uring/poll: don't lose the error of a failed poll update
@ 2026-11-19  7:44 Yichong Chen
  0 siblings, 0 replies; only message in thread
From: Yichong Chen @ 2026-11-19  7:44 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Pavel Begunkov, linux-kernel, Yichong Chen

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-19  7:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19  7:44 [PATCH] io_uring/poll: don't lose the error of a failed poll update Yichong Chen

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®