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

Greg Kroah-Hartman
2026-04-23T12:38:11Z

On Tue, Apr 21, 2026 at 04:58:52PM -0600, Jens Axboe wrote:
> On 4/21/26 4:18 PM, Jens Axboe wrote:
> >>> @@ -6024,16 +6035,17 @@ static int io_poll_update(struct io_kioc
> >>> if (req->poll_update.update_user_data)
> >>> preq->user_data = req->poll_update.new_user_data;
> >>>
> >>> - ret2 = io_poll_add(preq, issue_flags);
> >>> + ret2 = __io_poll_add(preq, issue_flags);
> >>> /* successfully updated, don't complete poll request */
> >>> if (!ret2)
> >>> goto out;
> >>> + preq->result = ret2;
> >>> +
> >>> }
> >>> - req_set_fail(preq);
> >>> - io_req_complete(preq, -ECANCELED);
> >>> + if (preq->result < 0)
> >>> + req_set_fail(preq);
> >>> + io_req_complete(preq, preq->result);
> >>
> >> If __io_poll_add() returned an events mask then it completed preq, but
> >> then we also complete preq here. Is that really correct?
> >
> > Let me take a closer look, I do agree with you that the final result
> > does not look entirely correct.
>
> As far as I can tell, these two should be applied to 5.10 and 5.15
> stable. The first one fixes an old backporting issue that I didn't
> notice until doing some targeted testing just now. The second one should
> take care of the issues that Ben spotted in the current backport.

Now applied.

> Will be nice when 5.x is finally taken out behind the barn :-)

Totally agree...

greg k-h