From: Xin Long Date: Sun, 25 Mar 2018 17:16:47 +0000 (+0800) Subject: bonding: process the err returned by dev_set_allmulti properly in bond_enslave X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=commitdiff_plain;h=19277917a0db893344f247d2ed4ac920c874f0d6;hp=1731866a8cdbf8b8c49348083c565ba0f2b6abff;ds=sidebyside bonding: process the err returned by dev_set_allmulti properly in bond_enslave commit 9f5a90c107741b864398f4ac0014711a8c1d8474 upstream. 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 Acked-by: Andy Gospodarek Signed-off-by: David S. Miller [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings --- diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 9145834cdebe..18ebffab9e7c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1704,8 +1704,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_close; + } } netif_addr_lock_bh(bond_dev);