]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.10/bonding-fix-event-handling-for-stacked-bonds.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 5.0.10 / bonding-fix-event-handling-for-stacked-bonds.patch
1 From foo@baz Sat Apr 20 16:43:09 CEST 2019
2 From: Sabrina Dubroca <sd@queasysnail.net>
3 Date: Fri, 12 Apr 2019 15:04:10 +0200
4 Subject: bonding: fix event handling for stacked bonds
5
6 From: Sabrina Dubroca <sd@queasysnail.net>
7
8 [ Upstream commit 92480b3977fd3884649d404cbbaf839b70035699 ]
9
10 When a bond is enslaved to another bond, bond_netdev_event() only
11 handles the event as if the bond is a master, and skips treating the
12 bond as a slave.
13
14 This leads to a refcount leak on the slave, since we don't remove the
15 adjacency to its master and the master holds a reference on the slave.
16
17 Reproducer:
18 ip link add bondL type bond
19 ip link add bondU type bond
20 ip link set bondL master bondU
21 ip link del bondL
22
23 No "Fixes:" tag, this code is older than git history.
24
25 Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
26 Signed-off-by: David S. Miller <davem@davemloft.net>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 ---
29 drivers/net/bonding/bond_main.c | 6 +++++-
30 1 file changed, 5 insertions(+), 1 deletion(-)
31
32 --- a/drivers/net/bonding/bond_main.c
33 +++ b/drivers/net/bonding/bond_main.c
34 @@ -3214,8 +3214,12 @@ static int bond_netdev_event(struct noti
35 return NOTIFY_DONE;
36
37 if (event_dev->flags & IFF_MASTER) {
38 + int ret;
39 +
40 netdev_dbg(event_dev, "IFF_MASTER\n");
41 - return bond_master_netdev_event(event, event_dev);
42 + ret = bond_master_netdev_event(event, event_dev);
43 + if (ret != NOTIFY_DONE)
44 + return ret;
45 }
46
47 if (event_dev->flags & IFF_SLAVE) {