summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-05-22 15:46:38 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-22 15:46:38 -0400
commitff1f9747dd95a5e4da78f723763843f2e21c88ed (patch)
tree8fac08b65e226b156f8cfe3089fb8dfbae4cc323 /drivers
parent11ee46f281ce0e51a4fc65708e59c57c73780ff4 (diff)
parentf6dcf561e653fb3a5048b40cb96c10f6d4d25c86 (diff)
Merge branch 'bonding'
Veaceslav Falico says: ==================== bonding: fix enslaving a dev without mtu setting support With the introduction of bond_free_slave() we need to have slave->bond populated before calling it, however if the dev_mtu_set(slave, mtu) fails, we call bond_free_slave() before actually setting slave->bond, and thus we'll panic. Fix this by populating slave->bond (and ->dev, it seems appropriate) as early as possible. Also, remove a harmful check for NULL in bond_get_bond_by_slave(), as it's only hiding the real problem and making it harder to debug. ==================== CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bonding/bond_main.c4
-rw-r--r--drivers/net/bonding/bonding.h2
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9071139d2871..499645b0925c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1326,6 +1326,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
goto err_undo_flags;
}
+ new_slave->bond = bond;
+ new_slave->dev = slave_dev;
/*
* Set the new_slave's queue_id to be zero. Queue ID mapping
* is set via sysfs or module option if desired.
@@ -1369,8 +1371,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
goto err_restore_mac;
}
- new_slave->bond = bond;
- new_slave->dev = slave_dev;
slave_dev->priv_flags |= IFF_BONDING;
if (bond_is_lb(bond)) {
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 44334b3d3b88..dfc37797df41 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -249,8 +249,6 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond,
static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
{
- if (!slave || !slave->bond)
- return NULL;
return slave->bond;
}