diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2019-04-12 15:04:10 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-27 09:30:29 +0200 |
commit | dd70ca6724cb19c7a7464d3c7d83b0ad2a464409 (patch) | |
tree | bc9f6f172751a750b2cd01e7b8ebad89f403028c /drivers/net | |
parent | 0e6fdf586a39c870dc2dba8f624009340328bd41 (diff) | |
download | linux-stable-dd70ca6724cb19c7a7464d3c7d83b0ad2a464409.tar.gz linux-stable-dd70ca6724cb19c7a7464d3c7d83b0ad2a464409.tar.bz2 linux-stable-dd70ca6724cb19c7a7464d3c7d83b0ad2a464409.zip |
bonding: fix event handling for stacked bonds
[ Upstream commit 92480b3977fd3884649d404cbbaf839b70035699 ]
When a bond is enslaved to another bond, bond_netdev_event() only
handles the event as if the bond is a master, and skips treating the
bond as a slave.
This leads to a refcount leak on the slave, since we don't remove the
adjacency to its master and the master holds a reference on the slave.
Reproducer:
ip link add bondL type bond
ip link add bondU type bond
ip link set bondL master bondU
ip link del bondL
No "Fixes:" tag, this code is older than git history.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 126ce5e24fc1..3e4713eedc6e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2958,8 +2958,12 @@ static int bond_netdev_event(struct notifier_block *this, return NOTIFY_DONE; if (event_dev->flags & IFF_MASTER) { + int ret; + netdev_dbg(event_dev, "IFF_MASTER\n"); - return bond_master_netdev_event(event, event_dev); + ret = bond_master_netdev_event(event, event_dev); + if (ret != NOTIFY_DONE) + return ret; } if (event_dev->flags & IFF_SLAVE) { |