]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net: bridge: guard the switchdev replay helpers against a NULL notifier block
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 21 Jul 2021 16:24:02 +0000 (19:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Jul 2021 07:26:23 +0000 (00:26 -0700)
There is a desire to make the object and FDB replay helpers optional
when moving them inside the bridge driver. For example a certain driver
might not offload host MDBs and there is no case where the replay
helpers would be of immediate use to it.

So it would be nice if we could allow drivers to pass NULL pointers for
the atomic and blocking notifier blocks, and the replay helpers to do
nothing in that case.

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>
net/bridge/br_fdb.c
net/bridge/br_mdb.c
net/bridge/br_vlan.c

index 2b862cffc03a0868b4d1bb5e318ca9928e34d0f0..47f190b6bfa37d751131c4da11f5f806dfc0d612 100644 (file)
@@ -760,6 +760,9 @@ int br_fdb_replay(const struct net_device *br_dev, const struct net_device *dev,
        unsigned long action;
        int err = 0;
 
+       if (!nb)
+               return 0;
+
        if (!netif_is_bridge_master(br_dev))
                return -EINVAL;
 
index 25d690b96cec1c19fee451d9b160f138e9f546a6..e58f1a4ac9626dd0f82155e6f1e039257e3c5ff4 100644 (file)
@@ -617,6 +617,9 @@ int br_mdb_replay(struct net_device *br_dev, struct net_device *dev,
 
        ASSERT_RTNL();
 
+       if (!nb)
+               return 0;
+
        if (!netif_is_bridge_master(br_dev) || !netif_is_bridge_port(dev))
                return -EINVAL;
 
index e66b004df7637626c74e79f39332d7ca2c092d9f..45ef07f682f19df4f0ad1ed6a90638c512e5ae92 100644 (file)
@@ -1856,6 +1856,9 @@ int br_vlan_replay(struct net_device *br_dev, struct net_device *dev,
 
        ASSERT_RTNL();
 
+       if (!nb)
+               return 0;
+
        if (!netif_is_bridge_master(br_dev))
                return -EINVAL;