Skip to content

Commit

Permalink
team: move dev_mc_sync after master_upper_dev_link in team_port_add
Browse files Browse the repository at this point in the history
[ Upstream commit 982cf3b ]

The same fix as in 'bonding: move dev_mc_sync after master_upper_dev_link
in bond_enslave' is needed for team driver.

The panic can be reproduced easily:

  ip link add team1 type team
  ip link set team1 up
  ip link add link team1 vlan1 type vlan id 80
  ip link set vlan1 master team1

Fixes: cb41c99 ("team: team should sync the port's uc/mc addrs when add a port")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Xin Long authored and Greg Kroah-Hartman committed Apr 12, 2018
1 parent 0f9e7b3 commit a17ab0a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -1197,11 +1197,6 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
goto err_dev_open;
}

netif_addr_lock_bh(dev);
dev_uc_sync_multiple(port_dev, dev);
dev_mc_sync_multiple(port_dev, dev);
netif_addr_unlock_bh(dev);

err = vlan_vids_add_by_dev(port_dev, dev);
if (err) {
netdev_err(dev, "Failed to add vlan ids to device %s\n",
Expand Down Expand Up @@ -1241,6 +1236,11 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
goto err_option_port_add;
}

netif_addr_lock_bh(dev);
dev_uc_sync_multiple(port_dev, dev);
dev_mc_sync_multiple(port_dev, dev);
netif_addr_unlock_bh(dev);

port->index = -1;
list_add_tail_rcu(&port->list, &team->port_list);
team_port_enable(team, port);
Expand All @@ -1265,8 +1265,6 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
vlan_vids_del_by_dev(port_dev, dev);

err_vids_add:
dev_uc_unsync(port_dev, dev);
dev_mc_unsync(port_dev, dev);
dev_close(port_dev);

err_dev_open:
Expand Down

0 comments on commit a17ab0a

Please sign in to comment.