public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Yuan Tan <yuantan098@gmail.com>, Ren Wei <n05ec@lzu.edu.cn>,
	io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, yifanwucs@gmail.com,
	tomapufckgml@gmail.com, bird@lzu.edu.cn, zcliangcn@gmail.com,
	ylong030@ucr.edu
Subject: Re: [PATCH 1/1] io_uring/poll: fix signed comparison in io_poll_get_ownership()
Date: Thu, 16 Apr 2026 09:28:34 -0600	[thread overview]
Message-ID: <d46b8edc-e63d-4d5b-a235-b74693402c89@kernel.dk> (raw)
In-Reply-To: <e5b35ee6-8255-4164-8aef-3b9168634529@gmail.com>

On 4/15/26 7:50 PM, Yuan Tan wrote:
> 
> On 4/15/26 13:09, Jens Axboe wrote:
>> On 4/12/26 2:38 AM, Ren Wei wrote:
>>> From: Longxuan Yu <ylong030@ucr.edu>
>>>
>>> io_poll_get_ownership() uses a signed comparison to check whether
>>> poll_refs has reached the threshold for the slowpath:
>>>
>>>     if (unlikely(atomic_read(&req->poll_refs) >= IO_POLL_REF_BIAS))
>>>
>>> atomic_read() returns int (signed). When IO_POLL_CANCEL_FLAG
>>> (BIT(31)) is set in poll_refs, the value becomes negative in
>>> signed arithmetic, so the >= 128 comparison always evaluates to
>>> false and the slowpath is never taken.
>>>
>>> Fix this by casting the atomic_read() result to unsigned int
>>> before the comparison, so that the cancel flag is treated as a
>>> large positive value and correctly triggers the slowpath.
>>>
>>> Fixes: aa43477b0402 ("io_uring: poll rework")
>> Is this correct? Seems it should be:
>>
>> Fixes: a26a35e9019f ("io_uring: make poll refs more robust")
>>
> I just double check it. Yes we were wrong. Correct bug inducing commit is 
> 
> a26a35e9019f ("io_uring: make poll refs more robust").
> 
> Thanks for pointing it out.
> 
> 
> Do we need to send a v2 to fix this?

No need, I corrected it already while applying yesterday.

-- 
Jens Axboe


      reply	other threads:[~2026-04-16 15:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1775965597.git.ylong030@ucr.edu>
2026-04-12  8:38 ` [PATCH 1/1] io_uring/poll: fix signed comparison in io_poll_get_ownership() Ren Wei
2026-04-14 10:50   ` Pavel Begunkov
2026-04-15 20:08   ` Jens Axboe
2026-04-15 20:09   ` Jens Axboe
2026-04-16  1:50     ` Yuan Tan
2026-04-16 15:28       ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d46b8edc-e63d-4d5b-a235-b74693402c89@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=bird@lzu.edu.cn \
    --cc=io-uring@vger.kernel.org \
    --cc=n05ec@lzu.edu.cn \
    --cc=tomapufckgml@gmail.com \
    --cc=yifanwucs@gmail.com \
    --cc=ylong030@ucr.edu \
    --cc=yuantan098@gmail.com \
    --cc=zcliangcn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox