On Thu, Mar 19, 2026 at 11:58:56AM +0800, Jiayuan Chen wrote: > From: Jiayuan Chen <[email protected]> > > Add a selftest to reproduce the infinite recursion in bond_header_parse() > when bonds are stacked (bond1 -> bond0 -> gre). When a packet is received > via AF_PACKET SOCK_DGRAM on the topmost bond, dev_parse_header() calls > bond_header_parse() which used skb->dev (always the topmost bond) to get > the bonding struct. This caused it to recurse back into itself > indefinitely, leading to stack overflow. > > Before commit b7405dcf7385 ("bonding: prevent potential infinite loop > in bond_header_parse()"), the test triggers: > > ./bond_stacked_header_parse.sh > > [ 71.999481] BUG: MAX_LOCK_DEPTH too low! > [ 72.000170] turning off the locking correctness validator. > [ 72.001029] Please attach the output of /proc/lock_stat to the bug report > [ 72.002079] depth: 48 max: 48! > ... > > After the fix, everything works fine: > > ./bond_stacked_header_parse.sh > TEST: Stacked bond header_parse does not recurse [ OK ] > > Cc: Jiayuan Chen <[email protected]> > Signed-off-by: Jiayuan Chen <[email protected]> > --- > Changes in v3: > - Fix CONFIG_NET_IPGRE sorting order in config > > Changes in v2: > - Use tcpdump + scapy instead of custom Python script > - Remove unnecessary modprobe and skip checks > - Add CONFIG_NET_IPGRE to config dependencies > > v1: https://lore.kernel.org/netdev/[email protected]/T/#t > https://lore.kernel.org/netdev/CANn89iK2EURqsjtd=ovp4awytjhgcr-uu-v9wovpwr1z3f0...@mail.gmail.com/ > --- > .../selftests/drivers/net/bonding/Makefile | 1 + > .../net/bonding/bond_stacked_header_parse.sh | 69 +++++++++++++++++++
Please take some time to run shellcheck over bond_stacked_header_parse.sh and make it shellcheck clean. I suggest that can be achieved by adding the following somewhere: # shellcheck disable=SC2034,SC2329 -- pw-bot: changes-requested

