Commit ff1f9747 authored by David S. Miller's avatar David S. Miller

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: default avatarVeaceslav Falico <vfalico@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 11ee46f2 f6dcf561
...@@ -1326,6 +1326,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1326,6 +1326,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
goto err_undo_flags; 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 * Set the new_slave's queue_id to be zero. Queue ID mapping
* is set via sysfs or module option if desired. * 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,8 +1371,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
goto err_restore_mac; goto err_restore_mac;
} }
new_slave->bond = bond;
new_slave->dev = slave_dev;
slave_dev->priv_flags |= IFF_BONDING; slave_dev->priv_flags |= IFF_BONDING;
if (bond_is_lb(bond)) { if (bond_is_lb(bond)) {
......
...@@ -249,8 +249,6 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, ...@@ -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) static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
{ {
if (!slave || !slave->bond)
return NULL;
return slave->bond; return slave->bond;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment