aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f0f5eab0fab1..798ae69fb63c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
175 "the same MAC; 0 for none (default), " 175 "the same MAC; 0 for none (default), "
176 "1 for active, 2 for follow"); 176 "1 for active, 2 for follow");
177module_param(all_slaves_active, int, 0); 177module_param(all_slaves_active, int, 0);
178MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" 178MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface "
179 "by setting active flag for all slaves; " 179 "by setting active flag for all slaves; "
180 "0 for never (default), 1 for always."); 180 "0 for never (default), 1 for always.");
181module_param(resend_igmp, int, 0); 181module_param(resend_igmp, int, 0);
@@ -3659,8 +3659,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
3659 else 3659 else
3660 bond_xmit_slave_id(bond, skb, 0); 3660 bond_xmit_slave_id(bond, skb, 0);
3661 } else { 3661 } else {
3662 slave_id = bond_rr_gen_slave_id(bond); 3662 int slave_cnt = ACCESS_ONCE(bond->slave_cnt);
3663 bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); 3663
3664 if (likely(slave_cnt)) {
3665 slave_id = bond_rr_gen_slave_id(bond);
3666 bond_xmit_slave_id(bond, skb, slave_id % slave_cnt);
3667 } else {
3668 dev_kfree_skb_any(skb);
3669 }
3664 } 3670 }
3665 3671
3666 return NETDEV_TX_OK; 3672 return NETDEV_TX_OK;
@@ -3691,8 +3697,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d
3691static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) 3697static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
3692{ 3698{
3693 struct bonding *bond = netdev_priv(bond_dev); 3699 struct bonding *bond = netdev_priv(bond_dev);
3700 int slave_cnt = ACCESS_ONCE(bond->slave_cnt);
3694 3701
3695 bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb) % bond->slave_cnt); 3702 if (likely(slave_cnt))
3703 bond_xmit_slave_id(bond, skb,
3704 bond_xmit_hash(bond, skb) % slave_cnt);
3705 else
3706 dev_kfree_skb_any(skb);
3696 3707
3697 return NETDEV_TX_OK; 3708 return NETDEV_TX_OK;
3698} 3709}