From: Cong Wang <xiyou.wangcong@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Cong Wang <cong.wang@bytedance.com>,
shaozhengchao <shaozhengchao@huawei.com>,
Paolo Abeni <pabeni@redhat.com>,
Tom Herbert <tom@herbertland.com>
Subject: Re: [Patch net] kcm: fix a race condition in kcm_recvmsg()
Date: Fri, 28 Oct 2022 12:24:55 -0700 [thread overview]
Message-ID: <Y1wsh66c7693OV/D@pop-os.localdomain> (raw)
In-Reply-To: <CANn89iJr+RdwnyoBmFmtc0m7KDSOg-5GboBpCOc4Diut9W8W6A@mail.gmail.com>
On Tue, Oct 25, 2022 at 04:49:48PM -0700, Eric Dumazet wrote:
> On Tue, Oct 25, 2022 at 4:02 PM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Sat, 22 Oct 2022 19:30:44 -0700 Cong Wang wrote:
> > > + spin_lock_bh(&mux->rx_lock);
> > > KCM_STATS_INCR(kcm->stats.rx_msgs);
> > > skb_unlink(skb, &sk->sk_receive_queue);
> > > + spin_unlock_bh(&mux->rx_lock);
> >
> > Why not switch to __skb_unlink() at the same time?
> > Abundance of caution?
> >
> > Adding Eric who was fixing KCM bugs recently.
>
> I think kcm_queue_rcv_skb() might have a similar problem if/when
> called from requeue_rx_msgs()
>
> (The mux->rx_lock spinlock is not acquired, and skb_queue_tail() is used)
rx_lock is acquired at least by 2 callers of it, requeue_rx_msgs() and
kcm_rcv_ready(). kcm_rcv_strparser() seems missing it, I can fix this in
a separate patch as no one actually reported a bug.
Thanks.
next prev parent reply other threads:[~2022-10-28 19:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-23 2:30 [Patch net] kcm: fix a race condition in kcm_recvmsg() Cong Wang
2022-10-25 23:02 ` Jakub Kicinski
2022-10-25 23:49 ` Eric Dumazet
2022-10-28 19:24 ` Cong Wang [this message]
2022-10-28 19:21 ` Cong Wang
2022-10-28 23:27 ` Jakub Kicinski
2022-11-01 20:52 ` Cong Wang
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=Y1wsh66c7693OV/D@pop-os.localdomain \
--to=xiyou.wangcong@gmail.com \
--cc=cong.wang@bytedance.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaozhengchao@huawei.com \
--cc=tom@herbertland.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