Re: [PATCH v2] net:bonding:support balance-alb interface with vlan to bridge

From: Jay Vosburgh
Date: Wed Aug 10 2022 - 17:09:54 EST


patchwork-bot+netdevbpf@xxxxxxxxxx wrote:

>Hello:
>
>This patch was applied to netdev/net.git (master)
>by David S. Miller <davem@xxxxxxxxxxxxx>:
>
>On Mon, 8 Aug 2022 23:21:03 -0700 you wrote:
>> In my test, balance-alb bonding with two slaves eth0 and eth1,
>> and then Bond0.150 is created with vlan id attached bond0.
>> After adding bond0.150 into one linux bridge, I noted that Bond0,
>> bond0.150 and bridge were assigned to the same MAC as eth0.
>> Once bond0.150 receives a packet whose dest IP is bridge's
>> and dest MAC is eth1's, the linux bridge will not match
>> eth1's MAC entry in FDB, and not handle it as expected.
>> The patch fix the issue, and diagram as below:
>>
>> [...]
>
>Here is the summary with links:
> - [v2] net:bonding:support balance-alb interface with vlan to bridge
> https://git.kernel.org/netdev/net/c/d5410ac7b0ba
>
>You are awesome, thank you!

There looks to be a reference count leak in the existing patch
(ip_dev_find acquires a reference that is not released). I.e., it needs
something like:

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 60cb9a0225aa..b9dbad3a8af8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -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)) {

I haven't tested this, but it seems correct. Comments?

I'll create a formal submission here in a bit.

-J

---
-Jay Vosburgh, jay.vosburgh@xxxxxxxxxxxxx