io_uring/poll: don't lose the error of a failed poll update
PATCH 1/1 io_uring/poll: don't lose the error of a failed poll update
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 <[email protected]>
--- io_uring/poll.c | 3 +++ 1 file changed, 3 insertions(+)
io_uring/poll.c +3 -0
@@ -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 );
Signature · 1 line
2.51.0