Skip to content

Commit

Permalink
net: bridge: guard the switchdev replay helpers against a NULL notifi…
Browse files Browse the repository at this point in the history
…er block

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>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Jul 22, 2021
1 parent 2f5dc00 commit 7105b50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/bridge/br_fdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions net/bridge/br_mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions net/bridge/br_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 7105b50

Please sign in to comment.