Re: [PATCH 5.10 491/491] io_uring/poll: correctly handle io_poll_add() return value on update

Fedor Pchelkin
2026-05-01T22:26:15Z

On Fri, 01. May 16:07, Jens Axboe wrote:
> On 5/1/26 3:55 PM, Fedor Pchelkin wrote:
> >> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> >> index 8b0dfea96ee0..b17a26b1b5e1 100644
> >> --- a/io_uring/io_uring.c
> >> +++ b/io_uring/io_uring.c
> >> @@ -6006,7 +6006,7 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags)
> >> {
> >> struct io_ring_ctx *ctx = req->ctx;
> >> struct io_kiocb *preq;
> >> - int ret2, ret = 0;
> >> + int ret2 = -ECANCELED, ret = 0;
> >>
> >> io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
> >>
> >> @@ -6037,7 +6037,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:
> >>
> >>
> >> The fixup patch may be updated with this if the changes look OK.
> >>
> >
> > Or maybe this one which is less hassle:
> >
> > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> > index 8b0dfea96ee0..bb01eaa9761f 100644
> > --- a/io_uring/io_uring.c
> > +++ b/io_uring/io_uring.c
> > @@ -6037,7 +6037,7 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags)
> > preq->result = ret2;
> >
> > }
> > - if (preq->result < 0)
> > + if (preq->result)
> > req_set_fail(preq);
> > io_req_complete(preq, preq->result);
> > out:
>
> That'd be fine. Note that both your patches are white space damaged. I

Argh, my fault.

> can send out updated fixup patches, the above does improve them. But at
> this point I don't even know what is queued up where. As far as I can
> tell neither 5.10-stable or 5.15-stable have the fixup queued up yet,
> even though I asked for it 10 days ago. Neither the fixup, nor the
> EPOLL_URING_WAKE patch.

They've been queued up to 5.10 and 5.15. The queues are available at [1,2]
from the official kernel git web urls.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/

While being in queue, the patches may be fixed up by stable maintainers if
I'm correct.

> From 8f1a401b0fce5a46935153f8572b0681d5b9a00d Mon Sep 17 00:00:00 2001
> From: Jens Axboe <axboe@kernel.dk>
> Date: Tue, 21 Apr 2026 16:44:06 -0600
> Subject: [PATCH 2/2] io_uring/poll: fix backport of io_poll_add() changes

[...]

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

I'm really uncomfortable to raise this but - ret2 should be initialized in
beginning of the function io_poll_update().