Skip to content

Commit a6e95cc

Browse files
shorman-netronomedavem330
authored andcommitted
rocker: handle non-bridge master change
Master change notifications may occur other than when joining or leaving a bridge, for example when being added to or removed from a bond or Open vSwitch. Previously in those cases rocker_port_bridge_leave() was called which results in a null-pointer dereference as rocker_port->bridge_dev is NULL because there is no bridge device. This patch makes provision for doing nothing in such cases. Fixes: 6c70794 ("rocker: implement L2 bridge offloading") Acked-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d079535 commit a6e95cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/ethernet/rocker/rocker.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4468,10 +4468,16 @@ static int rocker_port_master_changed(struct net_device *dev)
44684468
struct net_device *master = netdev_master_upper_dev_get(dev);
44694469
int err = 0;
44704470

4471+
/* There are currently three cases handled here:
4472+
* 1. Joining a bridge
4473+
* 2. Leaving a previously joined bridge
4474+
* 3. Other, e.g. being added to or removed from a bond or openvswitch,
4475+
* in which case nothing is done
4476+
*/
44714477
if (master && master->rtnl_link_ops &&
44724478
!strcmp(master->rtnl_link_ops->kind, "bridge"))
44734479
err = rocker_port_bridge_join(rocker_port, master);
4474-
else
4480+
else if (rocker_port_is_bridged(rocker_port))
44754481
err = rocker_port_bridge_leave(rocker_port);
44764482

44774483
return err;

0 commit comments

Comments
 (0)