From: David Kahurani <k.kahurani@gmail.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Yang Xiuwei <yangxiuwei2025@163.com>,
axboe@kernel.dk, io-uring@vger.kernel.org,
Yang Xiuwei <yangxiuwei@kylinos.cn>
Subject: Re: [PATCH] io_uring: fix incorrect io_kiocb reference in io_link_skb
Date: Fri, 19 Sep 2025 14:25:16 +0300 [thread overview]
Message-ID: <CAAZOf251fh-McW=7xdEQiWyQ-XfOC1tRTUnyTD4EHVaLG-2pvA@mail.gmail.com> (raw)
In-Reply-To: <CAAZOf24YaETroWiDjmTxu=2b2KVTxA1+rq_p5uxqtJqTVBfsJw@mail.gmail.com>
On Fri, Sep 19, 2025 at 2:23 PM David Kahurani <k.kahurani@gmail.com> wrote:
>
> This is something unrelated but just bringing it up because it is in the same locality.
>
> It doesn't seem like the references(uarg->refcnt) are well accounted for io_notif_data. Any node that gets passed to 'io_tx_ubuf_complete' will gets its refcnt decremented but assuming there's a list of nodes, some of the nodes in the list will not get their reference count decremented and that will trigger the lockdep_assert in 'io_notif_tw_complete'
>
> It doesn't look that this will have any consequences beyond triggering the lockderp_assert, though.
>
> Maybe my analysis is wrong?
>
>
> On Fri, Sep 19, 2025 at 2:16 PM Pavel Begunkov <asml.silence@gmail.com> wrote:
>>
>> On 9/19/25 10:03, Yang Xiuwei wrote:
>> > From: Yang Xiuwei <yangxiuwei@kylinos.cn>
>> >
>> > In io_link_skb function, there is a bug where prev_notif is incorrectly
>> > assigned using 'nd' instead of 'prev_nd'. This causes the context
>> > validation check to compare the current notification with itself instead
>> > of comparing it with the previous notification.
>> >
>> > Fix by using the correct prev_nd parameter when obtaining prev_notif.
>>
>> Good catch,
>>
>> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
>> Fixes: 6fe4220912d19 ("io_uring/notif: implement notification stacking")
>> Cc: stable@vger.kernel.org
>>
>>
>> > Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
>> >
>> > diff --git a/io_uring/notif.c b/io_uring/notif.c
>> > index 9a6f6e92d742..ea9c0116cec2 100644
>> > --- a/io_uring/notif.c
>> > +++ b/io_uring/notif.c
>> > @@ -85,7 +85,7 @@ static int io_link_skb(struct sk_buff *skb, struct ubuf_info *uarg)
>> > return -EEXIST;
>> >
>> > prev_nd = container_of(prev_uarg, struct io_notif_data, uarg);
>> > - prev_notif = cmd_to_io_kiocb(nd);
>> > + prev_notif = cmd_to_io_kiocb(prev_nd);
>> >
>> > /* make sure all noifications can be finished in the same task_work */
>> > if (unlikely(notif->ctx != prev_notif->ctx ||
>>
>> --
>> Pavel Begunkov
>>
>>
This is something unrelated but just bringing it up because it is in
the same locality.
It doesn't seem like the references(uarg->refcnt) are well accounted
for io_notif_data. Any node that gets passed to 'io_tx_ubuf_complete'
will gets it's refcnt decremented but assuming there's a list of
nodes, some of the nodes in the list will not get their reference
count decremented and that will trigger the lockdep_assert in
'io_notif_tw_complete'
It doesn't look that this will have any consequences beyond triggering
the lockderp_assert, though.
next prev parent reply other threads:[~2025-09-19 11:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 9:03 [PATCH] io_uring: fix incorrect io_kiocb reference in io_link_skb Yang Xiuwei
2025-09-19 11:18 ` Pavel Begunkov
[not found] ` <CAAZOf24YaETroWiDjmTxu=2b2KVTxA1+rq_p5uxqtJqTVBfsJw@mail.gmail.com>
2025-09-19 11:25 ` David Kahurani [this message]
2025-09-19 14:16 ` Pavel Begunkov
2025-09-19 14:28 ` David Kahurani
2025-09-22 7:52 ` Pavel Begunkov
2025-09-22 8:17 ` David Kahurani
2025-09-19 13:06 ` Jens Axboe
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='CAAZOf251fh-McW=7xdEQiWyQ-XfOC1tRTUnyTD4EHVaLG-2pvA@mail.gmail.com' \
--to=k.kahurani@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=yangxiuwei2025@163.com \
--cc=yangxiuwei@kylinos.cn \
/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