Commit 9f5a90c1 authored by Xin Long's avatar Xin Long Committed by David S. Miller

bonding: process the err returned by dev_set_allmulti properly in bond_enslave

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: 7e1a1ac1 ("bonding: Check return of dev_set_promiscuity/allmulti")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Acked-by: default avatarAndy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae42cc62
......@@ -1706,9 +1706,12 @@ 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);
dev_mc_sync_multiple(slave_dev, bond_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