summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2018-03-26 01:16:47 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-13 19:50:26 +0200
commit6773caa6ac54b84281113ce42d0557d4962380d7 (patch)
treec42714ca6f622b8989246963a2938bcef79c769d /drivers
parentefc484e07b5b70b2e59760d6ddde77d4de3cec63 (diff)
bonding: process the err returned by dev_set_allmulti properly in bond_enslave
[ Upstream commit 9f5a90c107741b864398f4ac0014711a8c1d8474 ] When dev_set_promiscuity(1) succeeds but dev_set_allmulti(1) fails, dev_set_promiscuity(-1) should be done before going to the err path. Otherwise, dev->promiscuity will leak. Fixes: 7e1a1ac1fbaa ("bonding: Check return of dev_set_promiscuity/allmulti") Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bonding/bond_main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 494e80210b98..278d12888cab 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1660,8 +1660,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
/* set allmulti level to new slave */
if (bond_dev->flags & IFF_ALLMULTI) {
res = dev_set_allmulti(slave_dev, 1);
- if (res)
+ if (res) {
+ if (bond_dev->flags & IFF_PROMISC)
+ dev_set_promiscuity(slave_dev, -1);
goto err_sysfs_del;
+ }
}
netif_addr_lock_bh(bond_dev);