aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@gmail.com>2014-05-21 11:42:00 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-22 15:46:34 -0400
commitdc73c41f4e0bdc3e43b6247d2b35e927739f1d9f (patch)
treedaeb30d3587f850f6cb805578305e153a8237339 /drivers/net/bonding
parent11ee46f281ce0e51a4fc65708e59c57c73780ff4 (diff)
bonding: populate essential new_slave->bond/dev early
The new bond_free_slave() needs new_slave->bond to verify if additional structures were allocated, so populate it early so that, in case of failure in bond_enslave(), we would be able to get it. Also populate the new_slave->dev field, as it's too one of the most needed things to assign early. CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Acked-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c4
1 files changed, 2 insertions, 2 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)
1326 goto err_undo_flags; 1326 goto err_undo_flags;
1327 } 1327 }
1328 1328
1329 new_slave->bond = bond;
1330 new_slave->dev = slave_dev;
1329 /* 1331 /*
1330 * Set the new_slave's queue_id to be zero. Queue ID mapping 1332 * Set the new_slave's queue_id to be zero. Queue ID mapping
1331 * is set via sysfs or module option if desired. 1333 * 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)
1369 goto err_restore_mac; 1371 goto err_restore_mac;
1370 } 1372 }
1371 1373
1372 new_slave->bond = bond;
1373 new_slave->dev = slave_dev;
1374 slave_dev->priv_flags |= IFF_BONDING; 1374 slave_dev->priv_flags |= IFF_BONDING;
1375 1375
1376 if (bond_is_lb(bond)) { 1376 if (bond_is_lb(bond)) {