[PATCH][bonding] division by zero bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
The patch is against bonding-2.4.20-20030207 in sorceforge 
(http://sourceforge.net/projects/bonding/).


diff -urN linux-2.4.20-20030207/drivers/net/bonding.c linux-2.4.20-devel/drivers/net/bonding.c
--- linux-2.4.20-20030207/drivers/net/bonding.c	2003-03-02 14:01:46.000000000 +0200
+++ linux-2.4.20-devel/drivers/net/bonding.c	2003-03-02 14:35:04.000000000 +0200
@@ -2597,6 +2597,13 @@
 		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) ) {


-- 
| Shmulik Hen                                 |
| Israel Design Center (Jerusalem)            |
| LAN Access Division                         |
| Intel Communications Group, Intel corp.     |
|                                             |
| Anti-Spam: shmulik dot hen at intel dot com |

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux