]>
Commit | Line | Data |
---|---|---|
07ff4eea GKH |
1 | From foo@baz Tue Apr 10 23:20:08 CEST 2018 |
2 | From: Xin Long <lucien.xin@gmail.com> | |
3 | Date: Mon, 26 Mar 2018 01:16:47 +0800 | |
4 | Subject: bonding: process the err returned by dev_set_allmulti properly in bond_enslave | |
5 | ||
6 | From: Xin Long <lucien.xin@gmail.com> | |
7 | ||
8 | ||
9 | [ Upstream commit 9f5a90c107741b864398f4ac0014711a8c1d8474 ] | |
10 | ||
11 | When dev_set_promiscuity(1) succeeds but dev_set_allmulti(1) fails, | |
12 | dev_set_promiscuity(-1) should be done before going to the err path. | |
13 | Otherwise, dev->promiscuity will leak. | |
14 | ||
15 | Fixes: 7e1a1ac1fbaa ("bonding: Check return of dev_set_promiscuity/allmulti") | |
16 | Signed-off-by: Xin Long <lucien.xin@gmail.com> | |
17 | Acked-by: Andy Gospodarek <andy@greyhouse.net> | |
18 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | --- | |
21 | drivers/net/bonding/bond_main.c | 5 ++++- | |
22 | 1 file changed, 4 insertions(+), 1 deletion(-) | |
23 | ||
24 | --- a/drivers/net/bonding/bond_main.c | |
25 | +++ b/drivers/net/bonding/bond_main.c | |
26 | @@ -1702,8 +1702,11 @@ int bond_enslave(struct net_device *bond | |
27 | /* set allmulti level to new slave */ | |
28 | if (bond_dev->flags & IFF_ALLMULTI) { | |
29 | res = dev_set_allmulti(slave_dev, 1); | |
30 | - if (res) | |
31 | + if (res) { | |
32 | + if (bond_dev->flags & IFF_PROMISC) | |
33 | + dev_set_promiscuity(slave_dev, -1); | |
34 | goto err_sysfs_del; | |
35 | + } | |
36 | } | |
37 | ||
38 | netif_addr_lock_bh(bond_dev); |