Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d632ce9

Browse files
nikolay@redhat.comdavem330
authored andcommitted
bonding: in bond_mc_swap() bond's mc addr list is walked without lock
Use netif_addr_lock_bh() to acquire the appropriate lock before walking. Signed-off-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fc7a72a commit d632ce9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
846846
if (bond->dev->flags & IFF_ALLMULTI)
847847
dev_set_allmulti(old_active->dev, -1);
848848

849+
netif_addr_lock_bh(bond->dev);
849850
netdev_for_each_mc_addr(ha, bond->dev)
850851
dev_mc_del(old_active->dev, ha->addr);
852+
netif_addr_unlock_bh(bond->dev);
851853
}
852854

853855
if (new_active) {
@@ -858,8 +860,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
858860
if (bond->dev->flags & IFF_ALLMULTI)
859861
dev_set_allmulti(new_active->dev, 1);
860862

863+
netif_addr_lock_bh(bond->dev);
861864
netdev_for_each_mc_addr(ha, bond->dev)
862865
dev_mc_add(new_active->dev, ha->addr);
866+
netif_addr_unlock_bh(bond->dev);
863867
}
864868
}
865869

0 commit comments

Comments
 (0)