Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/6] bonding: refactor bond_enslave() to fix XDP ordering and error rollback
@ 2026-11-13 14:04 Hangbin Liu
  2026-11-13 14:04 ` [PATCH net-next 1/6] bonding: check XDP support before enslaving changes state Hangbin Liu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Hangbin Liu @ 2026-11-13 14:04 UTC (permalink / raw)
  To: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
	Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev
  Cc: Hangbin Liu, netdev, linux-kernel, bpf, Hangbin Liu

`bond_enslave()` is over 500 lines long with complex logic and numerous
error rollback paths. It has XDP ordering isssue and missing some error
rollbacks for historical reasons (found by Sashiko when review bond
patches). The fixes are trivial, I plan to refactor the function to make
the logic clearer and resolved the issues. This patch set is the first
phase.

This series hardens bond_enslave() in two stages: first fix real
ordering and rollback bugs, then factor the function so the
infallible commit point and fail-fast validation stay obvious.

Problems fixed (patches 1-3):

1. XDP capability checks ran after the slave was opened, linked and
   could already be visible to the datapath . A slave without
   ndo_xdp_xmit could therefore be reached from bond_xdp_xmit().
   Checks move to the top of bond_enslave(), before any mutation.

2. Fallible XDP setup (dev_xdp_propagate()) ran after publication.
   On failure the undo ladder jumped to err_sysfs_del and leaked:
   - promiscuity / allmulti / synced addresses
   - ns maddrs added just before the failure

3. Error paths were incomplete versus release:
   - bond_alb_init_slave() success + later failure skipped
     bond_alb_deinit_slave() (TLB/RLB state, borrowed MAC)
   - bond_3ad_bind_slave() + later failure skipped
     bond_3ad_unbind_slave() (port left on its aggregator)
   - automatic fail_over_mac = "active" was not restored on failure

Cleanup (patches 4-6), no intended behaviour change beyond patch 5's
extack string alignment:

4. bond_publish_slave() — explicit infallible commit point
5. bond_slave_xdp_check() — shared by bond_enslave() and bond_xdp_set()
6. bond_enslave_validate() — all read-only checks

Testing: build debug kernel and run all kernel selftests

Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
Hangbin Liu (6):
      bonding: check XDP support before enslaving changes state
      bonding: finish XDP setup before publishing the slave
      bonding: complete rollback of bond_enslave() error paths
      bonding: factor out slave publication
      bonding: factor out XDP slave check
      bonding: factor out bond_enslave_validate

 drivers/net/bonding/bond_main.c | 174 ++++++++++++++++++++++++++--------------
 1 file changed, 116 insertions(+), 58 deletions(-)
---
base-commit: 573af801552999954caa8347e4490b04cf4763f0
change-id: 20261020-bond_enslave_restruct-30760e62def9

Best regards,
--  
Hangbin Liu <liuhangbin@kylinos.cn>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-13 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 14:04 [PATCH net-next 0/6] bonding: refactor bond_enslave() to fix XDP ordering and error rollback Hangbin Liu
2026-11-13 14:04 ` [PATCH net-next 1/6] bonding: check XDP support before enslaving changes state Hangbin Liu
2026-11-13 14:04 ` [PATCH net-next 2/6] bonding: finish XDP setup before publishing the slave Hangbin Liu
2026-11-13 14:04 ` [PATCH net-next 3/6] bonding: complete rollback of bond_enslave() error paths Hangbin Liu
2026-11-13 14:04 ` [PATCH net-next 4/6] bonding: factor out slave publication Hangbin Liu
2026-11-13 14:04 ` [PATCH net-next 5/6] bonding: factor out XDP slave check Hangbin Liu
2026-11-13 14:04 ` [PATCH net-next 6/6] bonding: factor out bond_enslave_validate Hangbin Liu
2026-11-13 14:11 ` [PATCH net-next 0/6] bonding: refactor bond_enslave() to fix XDP ordering and error rollback netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox