From: Jakub Kicinski <kuba@kernel.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Stanislav Fomichev <stfomichev@gmail.com>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org,
syzbot+b191b5ccad8d7a986286@syzkaller.appspotmail.com
Subject: Re: [PATCH net] af_packet: move notifier's packet_dev_mc out of rcu critical section
Date: Tue, 20 May 2025 20:00:20 -0700 [thread overview]
Message-ID: <20250520200020.270ff8b1@kernel.org> (raw)
In-Reply-To: <682d3d5a77189_97c02294a3@willemb.c.googlers.com.notmuch>
On Tue, 20 May 2025 22:41:30 -0400 Willem de Bruijn wrote:
> > @@ -4277,6 +4280,13 @@ static int packet_notifier(struct notifier_block *this,
> > }
> > }
> > rcu_read_unlock();
> > +
> > + /* packet_dev_mc might grab instance locks so can't run under rcu */
> > + list_for_each_entry_safe(ml, tmp, &mclist, remove_list) {
> > + packet_dev_mc(dev, ml, -1);
> > + kfree(ml);
> > + }
> > +
>
> Just verifying my understanding of the not entirely obvious locking:
>
> po->mclist modifications (add, del, flush, unregister) are all
> protected by the RTNL, not the RCU. The RCU only protects the sklist
> and by extension the sks on it. So moving the mclist operations out of
> the RCU is fine.
>
> The delayed operation on the mclist entry is still within the RTNL
> from unregister_netdevice_notifier. Which matter as it protects not
> only the list, but also the actual operations in packet_dev_mc, such
> as inc/dec on dev->promiscuity and associated dev_change_rx_flags.
> And new packet_mclist.remove_list too.
Matches my understanding FWIW, but this will be a great addition
to the commit message. Let's add it in v2..
> > return NOTIFY_DONE;
> > }
> >
> > diff --git a/net/packet/internal.h b/net/packet/internal.h
> > index d5d70712007a..1e743d0316fd 100644
> > --- a/net/packet/internal.h
> > +++ b/net/packet/internal.h
> > @@ -11,6 +11,7 @@ struct packet_mclist {
> > unsigned short type;
> > unsigned short alen;
> > unsigned char addr[MAX_ADDR_LEN];
> > + struct list_head remove_list;
>
> INIT_LIST_HEAD on alloc in packet_mc_add?
Just to be clear this is an "entry node" not a "head node",
is it common to init "entry nodes"?
--
for the commit msg:
pw-bot: cr
next prev parent reply other threads:[~2025-05-21 3:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 20:20 [PATCH net] af_packet: move notifier's packet_dev_mc out of rcu critical section Stanislav Fomichev
2025-05-21 2:41 ` Willem de Bruijn
2025-05-21 3:00 ` Jakub Kicinski [this message]
2025-05-21 3:53 ` Willem de Bruijn
2025-05-21 16:54 ` Stanislav Fomichev
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=20250520200020.270ff8b1@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@gmail.com \
--cc=syzbot+b191b5ccad8d7a986286@syzkaller.appspotmail.com \
--cc=willemdebruijn.kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.