]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bonding: process the err returned by dev_set_allmulti properly in bond_enslave
authorXin Long <lucien.xin@gmail.com>
Sun, 25 Mar 2018 17:16:47 +0000 (01:16 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Mar 2018 16:51:06 +0000 (12:51 -0400)
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>
drivers/net/bonding/bond_main.c

index 55e198554ec06b6e3877b8e7697c968223f54ac1..b7b11301885334315700dc8e3386253dd8178afb 100644 (file)
@@ -1706,8 +1706,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);