aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding')
-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 382a389b9bba..53904758d693 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);
@@ -3531,8 +3531,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
3531 else 3531 else
3532 bond_xmit_slave_id(bond, skb, 0); 3532 bond_xmit_slave_id(bond, skb, 0);
3533 } else { 3533 } else {
3534 slave_id = bond_rr_gen_slave_id(bond); 3534 int slave_cnt = ACCESS_ONCE(bond->slave_cnt);
3535 bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); 3535
3536 if (likely(slave_cnt)) {
3537 slave_id = bond_rr_gen_slave_id(bond);
3538 bond_xmit_slave_id(bond, skb, slave_id % slave_cnt);
3539 } else {
3540 dev_kfree_skb_any(skb);
3541 }
3536 } 3542 }
3537 3543
3538 return NETDEV_TX_OK; 3544 return NETDEV_TX_OK;
@@ -3562,8 +3568,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d
3562static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) 3568static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
3563{ 3569{
3564 struct bonding *bond = netdev_priv(bond_dev); 3570 struct bonding *bond = netdev_priv(bond_dev);
3571 int slave_cnt = ACCESS_ONCE(bond->slave_cnt);
3565 3572
3566 bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb) % bond->slave_cnt); 3573 if (likely(slave_cnt))
3574 bond_xmit_slave_id(bond, skb,
3575 bond_xmit_hash(bond, skb) % slave_cnt);
3576 else
3577 dev_kfree_skb_any(skb);
3567 3578
3568 return NETDEV_TX_OK; 3579 return NETDEV_TX_OK;
3569} 3580}