Re: [PATCH net] bonding: fix slave_cnt leak on XDP error paths

From: Hangbin Liu

Date: Wed Sep 02 2026 - 04:32:26 EST


On Wed, Sep 02, 2026 at 10:31:41AM +0300, Nikolay Aleksandrov wrote:
> On 02/09/2026 08:21, Hangbin Liu wrote:
> > From: Hangbin Liu <liuhangbin@xxxxxxxxxx>
> >
> > When bond_enslave() succeeds up to the XDP setup stage, slave_cnt is
> > already incremented. If XDP setup subsequently fails, the error paths
> > jump directly to err_sysfs_del, bypassing the slave_cnt decrement.
> >
> > This causes slave_cnt to drift upward on each failed enslaving attempt,
> > which would lead to unbalanced traffic distribution with round-robin and
> > balance-xor mode.
>
> I don't think it affects balance-xor, it's using usable_slaves->count which is
> incremented only for actual usable slaves

Ah, yes. I missed this.

>
> I think we can just move the slave count inc after XDP setup when we can't fail anymore?
> I don't see anything using it before the slave array update.

Makes sense to me. I will update the patch.

Thanks
Hangbin