summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2018-03-26 01:16:45 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-30 07:52:20 +0200
commit77c18f7ea4179ed45e979ad7b7432ffbeccaa3e5 (patch)
tree43eb3b86d68ce3f8c6df1727a4b9b9c83ac37557
parent6da5c98d65f0f87d8e12c62e421036777c4fadeb (diff)
downloadlinux-stable-77c18f7ea4179ed45e979ad7b7432ffbeccaa3e5.tar.gz
linux-stable-77c18f7ea4179ed45e979ad7b7432ffbeccaa3e5.tar.bz2
linux-stable-77c18f7ea4179ed45e979ad7b7432ffbeccaa3e5.zip
bonding: fix the err path for dev hwaddr sync in bond_enslave
[ Upstream commit 5c78f6bfae2b10ff70e21d343e64584ea6280c26 ] 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: 1ff412ad7714 ("bonding: change the bond's vlan syncing functions with the standard ones") Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Acked-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/bonding/bond_main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f0aa57222f17..00245b73c224 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1528,7 +1528,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
if (res) {
netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n",
slave_dev->name);
- goto err_close;
+ goto err_hwaddr_unsync;
}
prev_slave = bond_last_slave(bond);
@@ -1769,6 +1769,10 @@ err_detach:
synchronize_rcu();
slave_disable_netpoll(new_slave);
+err_hwaddr_unsync:
+ if (!bond_uses_primary(bond))
+ bond_hw_addr_flush(bond_dev, slave_dev);
+
err_close:
slave_dev->priv_flags &= ~IFF_BONDING;
dev_close(slave_dev);