Re: [PATCH net] bonding: only set speed/duplex to unknown, if getting speed failed

From: Thomas Bogendoerfer

Date: Tue Feb 03 2026 - 09:09:01 EST


On Tue, 3 Feb 2026 03:24:09 +0000
Hangbin Liu <liuhangbin@xxxxxxxxx> wrote:

> On Mon, Feb 02, 2026 at 03:17:26PM +0100, Thomas Bogendoerfer wrote:
> > On Fri, 30 Jan 2026 12:36:19 +0000
> > Hangbin Liu <liuhangbin@xxxxxxxxx> wrote:
> >
> > > On Fri, Jan 30, 2026 at 12:19:04PM +0100, Thomas Bogendoerfer wrote:
> > > > bond_update_speed_duplex() first set speed/duplex to unknown and
> > > > then asks slave driver for current speed/duplex. Since getting
> > > > speed/duplex might take longer there is a race, where this false state
> > > > is visible by /proc/net/bonding. With commit 691b2bf14946 ("bonding:
> > >
> > > The patch looks good to me. But based on your description, I don't think
> > > the fixes tag is correct.
> >
> > the race is old, but it got visible by that commit. Before
> > bond_update_speed_duplex() was only called on enslaving and when bond
> > is brought up. Now it could also be called during normal operation and
> > that's what caught attention by customers.
> >
> > I'm fine changing the fixes tag to whatever we agree to. So which should
> > I take ?
>
> Maybe
> 98f41f694f46 ("bonding:update speed/duplex for NETDEV_CHANGE") and
> 589665f5a600 ("bonding: comparing a u8 with -1 is always false")?
>
> The 98f41f694f46 set speed/duplex to -1 by default, which could cause the
> race to show SPEED_UNKNOWN. But (slave->duplex == -1) checking is always
> false, so no possible to show DUPLEX_UNKNOWN. The 589665f5a600 fixed this
> issue, after that speed/duplex both could be shown as UNKNOWN.

589665f5a600 only replaces the -1 with defines. So it doesn't introduce
semantic changes, but 98f41f694f46 did.

Thomas.

--
SUSE Software Solutions Germany GmbH
HRB 36809 (AG Nürnberg)
Geschäftsführer: Jochen Jaser, Andrew McDonald, Werner Knoblich