diff options
| author | Xin Long <lucien.xin@gmail.com> | 2018-03-25 13:16:47 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2018-03-26 12:51:06 -0400 |
| commit | 9f5a90c107741b864398f4ac0014711a8c1d8474 (patch) | |
| tree | 92874b623663faa0b49a6f7497aa1b3c410d8784 /drivers/net/bonding | |
| parent | ae42cc62a9f07f1f6979054ed92606b9c30f4a2e (diff) | |
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: 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>
Diffstat (limited to 'drivers/net/bonding')
| -rw-r--r-- | drivers/net/bonding/bond_main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 55e198554ec0..b7b113018853 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -1706,8 +1706,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, | |||
| 1706 | /* set allmulti level to new slave */ | 1706 | /* set allmulti level to new slave */ |
| 1707 | if (bond_dev->flags & IFF_ALLMULTI) { | 1707 | if (bond_dev->flags & IFF_ALLMULTI) { |
| 1708 | res = dev_set_allmulti(slave_dev, 1); | 1708 | res = dev_set_allmulti(slave_dev, 1); |
| 1709 | if (res) | 1709 | if (res) { |
| 1710 | if (bond_dev->flags & IFF_PROMISC) | ||
| 1711 | dev_set_promiscuity(slave_dev, -1); | ||
| 1710 | goto err_sysfs_del; | 1712 | goto err_sysfs_del; |
| 1713 | } | ||
| 1711 | } | 1714 | } |
| 1712 | 1715 | ||
| 1713 | netif_addr_lock_bh(bond_dev); | 1716 | netif_addr_lock_bh(bond_dev); |
