From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <stfomichev@gmail.com>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
netdev@vger.kernel.org, Jiayuan Chen <jiayuan.chen@shopee.com>,
syzbot+2b3391f44313b3983e91@syzkaller.appspotmail.com,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Sabrina Dubroca <sd@queasysnail.net>,
Stanislav Fomichev <sdf@fomichev.me>,
Kuniyuki Iwashima <kuniyu@google.com>,
Samiullah Khawaja <skhawaja@google.com>,
Ahmed Zaki <ahmed.zaki@intel.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Willem de Bruijn <willemb@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v1] net: defer __dev_set_promiscuity() to avoid sleeping in atomic context
Date: Thu, 19 Feb 2026 12:12:13 -0800 [thread overview]
Message-ID: <20260219121213.5b5ab0e7@kernel.org> (raw)
In-Reply-To: <aZdddVNRy6sYiUEt@mini-arch>
On Thu, 19 Feb 2026 10:59:01 -0800 Stanislav Fomichev wrote:
> On 02/18, Jakub Kicinski wrote:
> > On Tue, 17 Feb 2026 17:10:36 -0800 Stanislav Fomichev wrote:
> > > > Reproducer:
> > > >
> > > > ip link add dummy0 type dummy
> > > > ip link add team0 type team
> > > > ip link set dummy0 master team0
> > > > ip link set team0 up
> > > > ip link add bridge0 type bridge vlan_filtering 1
> > > > ip link set bridge0 up
> > > > ip link set team0 master bridge0
> > > > ip link add macsec0 link bridge0 type macsec
> > > > ip link set macsec0 up # triggers the bug
> > >
> > > Can you add it as a selftest under selftests/drivers/net/team/?
> >
> > Stan, this "fix" may work for the promisc flag but won't we have
> > the same problem with sync'ing the address list? Looks like team
> > will do:
> > - team_set_rx_mode()
> > - dev_uc_sync_multiple()
> > - __dev_set_rx_mode(port->dev)
> > so AFAICT we're calling ndo_set_rx_mode without holding the instance
> > lock?
>
> Not sure I understand your trace without more details about the hierarchy.
Team on top of a ops-locked netdev
- team_set_rx_mode() # set_rx_mode on team
- dev_uc_sync_multiple()
- __dev_set_rx_mode(port->dev) # calls ndo_set_rx_mode on ops-locked
# netdev without holding the inst. lock
IOW this will fire:
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 6285fbefe38a..77991f62bffc 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -184,6 +184,7 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
static void nsim_set_rx_mode(struct net_device *dev)
{
+ netdev_assert_locked(dev);
}
static int nsim_change_mtu(struct net_device *dev, int new_mtu)
> But you have a point, per netdevices.rst ndo_set_rx_mode is synchronized via
> netif_addr_lock and we are breaking that with this patch.. :-(
> (so I don't think we need an instance lock if we keep netif_addr_lock?)
>
> For this particular issue, maybe we can do something similar to net_todo_list?
> Instead of changing the promisc for !FLT under right here right now, move it
> to the rtnl_unlock? Not sure how important the ordering is..
Not sure. Another alternative is to implement the long standing idea of
having an async / sleeping version of ndo_set_rx_mode() orchestrated
by the core. Because a lot of drivers need to sleep, anyway, so they
just schedule a work from that callback.
Then we can say old ndo_set_rx_mode is under netif_addr_lock.
ndo_set_rx_mode_async is under instance lock.
next prev parent reply other threads:[~2026-02-19 20:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 3:38 [PATCH net v1] net: defer __dev_set_promiscuity() to avoid sleeping in atomic context Jiayuan Chen
2026-02-18 1:10 ` Stanislav Fomichev
2026-02-19 1:40 ` Jakub Kicinski
2026-02-19 18:59 ` Stanislav Fomichev
2026-02-19 20:12 ` Jakub Kicinski [this message]
2026-02-20 0:30 ` Stanislav Fomichev
2026-02-20 1:10 ` Jakub Kicinski
2026-02-20 5:21 ` I Viswanath
2026-02-21 1:15 ` Stanislav Fomichev
2026-02-20 20:45 ` I Viswanath
2026-02-21 6:23 ` Stanislav Fomichev
2026-02-21 1:22 ` Jakub Kicinski
2026-02-21 6:22 ` 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=20260219121213.5b5ab0e7@kernel.org \
--to=kuba@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiayuan.chen@linux.dev \
--cc=jiayuan.chen@shopee.com \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
--cc=sdf@fomichev.me \
--cc=skhawaja@google.com \
--cc=stfomichev@gmail.com \
--cc=syzbot+2b3391f44313b3983e91@syzkaller.appspotmail.com \
--cc=willemb@google.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