]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bonding: Fix slave selection bug.
authorHillf Danton <dhillf@gmail.com>
Fri, 10 Dec 2010 18:54:11 +0000 (18:54 +0000)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 17 Apr 2011 20:16:03 +0000 (16:16 -0400)
commit af3e5bd5f650163c2e12297f572910a1af1b8236 upstream

The returned slave is incorrect, if the net device under check is not
charged yet by the master.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/net/bonding/bonding.h

index 257a7a4dfce98b93f7d04130d21e98f3173c1ab2..d881eb830358ada6959d807e59ce2f8efdc92ea2 100644 (file)
@@ -235,11 +235,11 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n
 
        bond_for_each_slave(bond, slave, i) {
                if (slave->dev == slave_dev) {
-                       break;
+                       return slave;
                }
        }
 
-       return slave;
+       return 0;
 }
 
 static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)