Commit 77c18f7e authored by Xin Long's avatar Xin Long Committed by Greg Kroah-Hartman

bonding: fix the err path for dev hwaddr sync in bond_enslave

[ Upstream commit 5c78f6bf ]

vlan_vids_add_by_dev is called right after dev hwaddr sync, so on
the err path it should unsync dev hwaddr. Otherwise, the slave
dev's hwaddr will never be unsync when this err happens.

Fixes: 1ff412ad ("bonding: change the bond's vlan syncing functions with the standard ones")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: default avatarAndy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6da5c98d
...@@ -1528,7 +1528,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1528,7 +1528,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
if (res) { if (res) {
netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n",
slave_dev->name); slave_dev->name);
goto err_close; goto err_hwaddr_unsync;
} }
prev_slave = bond_last_slave(bond); prev_slave = bond_last_slave(bond);
...@@ -1769,6 +1769,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1769,6 +1769,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
synchronize_rcu(); synchronize_rcu();
slave_disable_netpoll(new_slave); slave_disable_netpoll(new_slave);
err_hwaddr_unsync:
if (!bond_uses_primary(bond))
bond_hw_addr_flush(bond_dev, slave_dev);
err_close: err_close:
slave_dev->priv_flags &= ~IFF_BONDING; slave_dev->priv_flags &= ~IFF_BONDING;
dev_close(slave_dev); dev_close(slave_dev);
......
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