Skip to content

Commit

Permalink
bonding: process the err returned by dev_set_allmulti properly in bon…
Browse files Browse the repository at this point in the history
…d_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: 7e1a1ac ("bonding: Check return of dev_set_promiscuity/allmulti")
Signed-off-by: Xin Long <[email protected]>
Acked-by: Andy Gospodarek <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
lxin authored and gregkh committed Apr 13, 2018
1 parent 0036076 commit 8666081
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,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);
Expand Down

0 comments on commit 8666081

Please sign in to comment.