Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 942f64c4 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller
Browse files

team: Fix possible deadlock during team enslave



Both dev_uc_sync_multiple() and dev_mc_sync_multiple() require the
source device to be locked by netif_addr_lock_bh(), but this is missing
in team's enslave function, so add it.

This fixes the following lockdep warning:

Possible interrupt unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(_xmit_ETHER/1);
                                local_irq_disable();
                                lock(&(&mc->mca_lock)->rlock);
                                lock(&team_netdev_addr_lock_key);
   <Interrupt>
     lock(&(&mc->mca_lock)->rlock);

  *** DEADLOCK ***

Fixes: cb41c997 ("team: team should sync the port's uc/mc addrs when add a port")
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6b65ca06
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1203,8 +1203,10 @@ 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) {