Commit de88f07f authored by Andrew Morton's avatar Andrew Morton Committed by James Bottomley

[PATCH] fix div-by-zero in bonding.c

Patch from: Shmulik Hen <hshmulik@intel.com>

The following patch fixes a division by zero bug in the bonding module that
happens when transmitting through a bond with no slaves, in the XOR bonding
mode.
parent fc60971f
......@@ -2574,6 +2574,13 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *dev)
return 0;
}
if (bond->slave_cnt == 0) {
/* no slaves in the bond, frame not sent */
dev_kfree_skb(skb);
read_unlock_irqrestore(&bond->lock, flags);
return 0;
}
slave_no = (data->h_dest[5]^slave->dev->dev_addr[5]) % bond->slave_cnt;
while ( (slave_no > 0) && (slave != (slave_t *)bond) ) {
......
Markdown is supported
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