netdev
[Top] [All Lists]

[PATCH][bonding] division by zero bug

To: bonding-devel@xxxxxxxxxxxxxxxxxxxxx, <linux-net@xxxxxxxxxxxxxxx>, <netdev@xxxxxxxxxxx>
Subject: [PATCH][bonding] division by zero bug
From: Shmulik Hen <hshmulik@xxxxxxxxx>
Date: Tue, 4 Mar 2003 19:11:42 +0200 (IST)
Cc: jgarzik@xxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
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 |


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH][bonding] division by zero bug, Shmulik Hen <=