diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-01-06 01:11:15 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-01-06 11:59:10 +0000 |
commit | c146f9bc195a9dc3ad7fd000a14540e7c9df952d (patch) | |
tree | 1c977af48b66748fbe0fd64f25e6721355018f7d /net/dsa/master.c | |
parent | a1ff94c2973c43bc1e2677ac63ebb15b1d1ff846 (diff) | |
download | linux-stable-c146f9bc195a9dc3ad7fd000a14540e7c9df952d.tar.gz linux-stable-c146f9bc195a9dc3ad7fd000a14540e7c9df952d.tar.bz2 linux-stable-c146f9bc195a9dc3ad7fd000a14540e7c9df952d.zip |
net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}
DSA needs to simulate master tracking events when a binding is first
with a DSA master established and torn down, in order to give drivers
the simplifying guarantee that ->master_state_change calls are made
only when the master's readiness state to pass traffic changes.
master_state_change() provide a operational bool that DSA driver can use
to understand if DSA master is operational or not.
To avoid races, we need to block the reception of
NETDEV_UP/NETDEV_CHANGE/NETDEV_GOING_DOWN events in the netdev notifier
chain while we are changing the master's dev->dsa_ptr (this changes what
netdev_uses_dsa(dev) reports).
The dsa_master_setup() and dsa_master_teardown() functions optionally
require the rtnl_mutex to be held, if the tagger needs the master to be
promiscuous, these functions call dev_set_promiscuity(). Move the
rtnl_lock() from that function and make it top-level.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/master.c')
-rw-r--r-- | net/dsa/master.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dsa/master.c b/net/dsa/master.c index f4efb244f91d..2199104ca7df 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -267,9 +267,9 @@ static void dsa_master_set_promiscuity(struct net_device *dev, int inc) if (!ops->promisc_on_master) return; - rtnl_lock(); + ASSERT_RTNL(); + dev_set_promiscuity(dev, inc); - rtnl_unlock(); } static ssize_t tagging_show(struct device *d, struct device_attribute *attr, |