Re: [PATCH net v1] team: fix header_ops type confusion with non-Ethernet ports
From: Jiayuan Chen
Date: Sat Mar 14 2026 - 07:52:19 EST
On 3/14/26 7:46 PM, Eric Dumazet wrote:
Thanks,My patch is ready and already running our tests before I submit it.
I reproduced the infinite recursion you described with stacked bonds
(bond1 -> bond0 -> gre0). With an AF_PACKET SOCK_DGRAM socket on bond1
and an inbound GRE packet, bond_header_parse() recurses endlessly
because skb->dev always points to bond1.
I can verify this patch, but changing the parse() signature touches
quite a few places beyond what's in the diff - net/mac802154/iface.c,
net/phonet/af_phonet.c, drivers/firewire/net.c all have their own
parse() implementations that need updating, plus eth_header_parse() is
declared in both etherdevice.h and if_ether.h.
I'm wondering if adding a separate callback (e.g. dev_parse) to
struct header_ops might be a cleaner approach - dev_parse_header()
would check for the new callback first and fall back to the existing
parse(). That way only bond (and team) need to implement it, and all
other drivers remain untouched. The tradeoff is one extra NULL check
in the receive path, which should be negligible.
git show | diffstat -p1
drivers/firewire/net.c | 5 +++--
drivers/net/bonding/bond_main.c | 8 +++++---
include/linux/etherdevice.h | 3 ++-
include/linux/if_ether.h | 3 ++-
include/linux/netdevice.h | 6 ++++--
net/ethernet/eth.c | 3 ++-
net/ipv4/ip_gre.c | 3 ++-
net/mac802154/iface.c | 4 +++-
net/phonet/af_phonet.c | 5 ++++-
9 files changed, 27 insertions(+), 13 deletions(-)
I see no issue with this fix, ->parse() is hardly in a fast path anyway.
Note that ->create() already has a 'struct net_device' pointer.
Thanks for the quick patch.
I also verified it fixes the recursion issue after modifying all signatures.