On Fri, Nov 27, 2026 at 02:37:28PM +0800, Hangbin Liu wrote:
> From: Hangbin Liu <liuh…@kylinos.cn>
>
> The XDP capability checks in bond_enslave() - ndo_bpf/ndo_xdp_xmit
> presence and whether the slave already runs an XDP program - run only
> after the slave has been opened, linked and published to the
> datapath. On failure the slave may already be bond->curr_active_slave
> or reachable through bond->slave_cnt and the upper device list, so a
> lot of state has to be undone, and bond_xdp_xmit() can observe the
> slave before its capability was ever verified.
>
> Move both checks into the validation section at the top of
> bond_enslave(), before the first state change, so a rejected slave
> returns directly with nothing mutated. bond_xdp_set() repeats the
> same two checks for every slave, so factor them into a common
> bond_slave_xdp_check() helper used by both paths.
>
> Signed-off-by: Hangbin Liu <liuh…@kylinos.cn>
> ---
> For Sashiko:
>
> please ignore the bond's promiscuity/allmulti/ns maddrs leak issue
> when xdp setup failed. It will be addressed in another patch.
>
> please ignore the no unwind for bond_3ad_bind_slave if
> dev_xdp_propagate failed. It will be addressed in another patch.
> ---
> Changes in v2:
> - move the duplicate checking in bond_xdp_set to the new check function.
> - Move the bond_xdp_xmit() fix in another patch and target to net (sashiko)
> - Link to v1: https://patch.msgid.link/2026…@kylinos.cn
> ---
Patch doesn't apply to latest net-next due to recent 802.3ad update.
I will rebase the code and repost a new version.
---
pw-bot: cr