[PATCH] io_uring/poll: don't lose the error of a failed poll update
From: Yichong Chen
Date: Thu Nov 19 2026 - 02:45:20 EST
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@xxxxxxxxxxxxx>
---
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