From 8f1a401b0fce5a46935153f8572b0681d5b9a00d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 21 Apr 2026 16:44:06 -0600 Subject: [PATCH 2/2] io_uring/poll: fix backport of io_poll_add() changes The 5.15/5.10 backport of 84230ad2d2af had a few issues, due to the older poll base. Notably return value handling __io_arm_poll_handler() and in return __io_poll_add() as well. Fix them up. Reported-by: Ben Hutchings Fixes: 349ef5d2e7bf ("io_uring/poll: correctly handle io_poll_add() return value on update") Signed-off-by: Jens Axboe --- io_uring/io_uring.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index db5c9fbdec3b..97d0ecec8322 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -6138,19 +6138,15 @@ static int __io_poll_add(struct io_kiocb *req, unsigned int issue_flags) if (!ret && ipt.error) req_set_fail(req); ret = ret ?: ipt.error; - if (ret > 0) { + if (ret) __io_req_complete(req, issue_flags, ret, 0); - return ret; - } - return 0; + return ret; } static int io_poll_add(struct io_kiocb *req, unsigned int issue_flags) { - int ret; - - ret = __io_poll_add(req, issue_flags); - return ret < 0 ? ret : 0; + __io_poll_add(req, issue_flags); + return 0; } static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags) @@ -6188,7 +6184,7 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags) preq->result = ret2; } - if (preq->result < 0) + if (ret2 < 0) req_set_fail(preq); io_req_complete(preq, preq->result); out: -- 2.53.0