Commit 7864a1ad authored by Veaceslav Falico's avatar Veaceslav Falico Committed by David S. Miller
Browse files

bonding: remove locking from bond_set_rx_mode()

We're already protected by RTNL lock, so nothing can happen to bond/its
slaves, and thus the locking is useless here (both bond->lock and

Also, add ASSERT_RTNL() both to bond_set_rx_mode() and bond_hw_addr_swap()
to catch possible uses of it without RTNL locking.

This patch also saves us from a lockdep false-positive in
bond_set_rx_mode() vs bond_hw_addr_swap().

CC: Jay Vosburgh <>
CC: Andy Gospodarek <>
CC: Nikolay Aleksandrov <>
Signed-off-by: default avatarVeaceslav Falico <>
Signed-off-by: default avatarNikolay Aleksandrov <>
Signed-off-by: default avatarDavid S. Miller <>
parent c193f365
......@@ -776,6 +776,8 @@ static void bond_hw_addr_flush(struct net_device *bond_dev,
static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
struct slave *old_active)
if (old_active) {
if (bond->dev->flags & IFF_PROMISC)
dev_set_promiscuity(old_active->dev, -1);
......@@ -3551,24 +3553,20 @@ static void bond_set_rx_mode(struct net_device *bond_dev)
struct bonding *bond = netdev_priv(bond_dev);
struct slave *slave;
if (USES_PRIMARY(bond->params.mode)) {
slave = bond->curr_active_slave;
slave = rtnl_dereference(bond->curr_active_slave);
if (slave) {
dev_uc_sync(slave->dev, bond_dev);
dev_mc_sync(slave->dev, bond_dev);
} else {
bond_for_each_slave(bond, slave) {
dev_uc_sync_multiple(slave->dev, bond_dev);
dev_mc_sync_multiple(slave->dev, bond_dev);
static int bond_neigh_init(struct neighbour *n)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment