Skip to contentSkip to conversation

bonding: fix reference count leak in balance-alb mode

PATCH Applied Jay Vosburgh 3 participants 3 messages Aug 11, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding: fix reference count leak in balance-alb mode

Commit d5410ac7b0ba ("net:bonding:support balance-alb interface
with vlan to bridge") introduced a reference count leak by not releasing the reference acquired by ip_dev_find(). Remedy this by insuring the reference is released.

Fixes d5410ac7b0ba ("net:bonding:support balance-alb interface with vlan to bridge")
---
 drivers/net/bonding/bond_alb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_alb.c +4 -1
index 60cb9a0225aa..b9dbad3a8af8 100644
@@ -668,8 +668,11 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
 
 	dev = ip_dev_find(dev_net(bond->dev), arp->ip_src);
 	if (dev) {
-		if (netif_is_bridge_master(dev))
+		if (netif_is_bridge_master(dev)) {
+			dev_put(dev);
 			return NULL;
+		}
+		dev_put(dev);
 	}
 
 	if (arp->op_code == htons(ARPOP_REPLY)) {
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Jay Vosburgh

Commit d5410ac7b0ba ("net:bonding:support balance-alb interface
with vlan to bridge") introduced a reference count leak by not releasing the reference acquired by ip_dev_find(). Remedy this by insuring the reference is released.

Fixes d5410ac7b0ba ("net:bonding:support balance-alb interface with vlan to bridge")
---
 drivers/net/bonding/bond_alb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_alb.c +0 -0
index 60cb9a0225aa..b9dbad3a8af8 100644
@@ -668,8 +668,11 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
 
 	dev = ip_dev_find(dev_net(bond->dev), arp->ip_src);

drivers/net/bonding/bond_alb.c static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) · line 678

Quoted 10 lines
drivers/net/bonding/bond_alb.c +4 -1
 	if (dev) {
-		if (netif_is_bridge_master(dev))
+		if (netif_is_bridge_master(dev)) {
+			dev_put(dev);
 			return NULL;
+		}
+		dev_put(dev);
 	}
 
 	if (arp->op_code == htons(ARPOP_REPLY)) {

Nice catch,

#2 lore raw
In reply to Jay Vosburgh
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 10 Aug 2022 22:06:53 -0700 you wrote:

Commit d5410ac7b0ba ("net:bonding:support balance-alb interface with vlan to bridge") introduced a reference count leak by not releasing the reference acquired by ip_dev_find(). Remedy this by insuring the reference is released.

Fixes d5410ac7b0ba ("net:bonding:support balance-alb interface with vlan to bridge")

[...]

Here is the summary with links:
- [net] bonding: fix reference count leak in balance-alb mode

    https://git.kernel.org/netdev/net/c/4f5d33f4f798

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html