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 --- 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