]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.34/bonding-process-the-err-returned-by-dev_set_allmulti-properly-in-bond_enslave.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.14.34 / bonding-process-the-err-returned-by-dev_set_allmulti-properly-in-bond_enslave.patch
CommitLineData
07ff4eea
GKH
1From foo@baz Tue Apr 10 23:20:08 CEST 2018
2From: Xin Long <lucien.xin@gmail.com>
3Date: Mon, 26 Mar 2018 01:16:47 +0800
4Subject: bonding: process the err returned by dev_set_allmulti properly in bond_enslave
5
6From: Xin Long <lucien.xin@gmail.com>
7
8
9[ Upstream commit 9f5a90c107741b864398f4ac0014711a8c1d8474 ]
10
11When dev_set_promiscuity(1) succeeds but dev_set_allmulti(1) fails,
12dev_set_promiscuity(-1) should be done before going to the err path.
13Otherwise, dev->promiscuity will leak.
14
15Fixes: 7e1a1ac1fbaa ("bonding: Check return of dev_set_promiscuity/allmulti")
16Signed-off-by: Xin Long <lucien.xin@gmail.com>
17Acked-by: Andy Gospodarek <andy@greyhouse.net>
18Signed-off-by: David S. Miller <davem@davemloft.net>
19Signed-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);