Re: [PATCH net-next] net: phylink: reject unsupported speed/duplex in ksettings_set() with PHY
From: Andrew Lunn
Date: Tue Jul 07 2026 - 11:56:27 EST
On Mon, Jul 06, 2026 at 11:27:35PM -0700, muhammad.nazim.amirul.nazle.asmade@xxxxxxxxxx wrote:
> From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@xxxxxxxxxx>
>
> When using ethtool to change speed and duplex on a phylink-managed
> interface with a PHY attached, the requested speed/duplex combination
> is not validated against the MAC's supported capabilities before being
> passed down to the PHY layer.
How are you invoking ethtool here? And what other invocations have you
tested, with this patch in place?
> @@ -2989,6 +2989,10 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
> if (pl->phydev) {
> struct ethtool_link_ksettings phy_kset = *kset;
>
> + if (!phy_caps_lookup(kset->base.speed, kset->base.duplex,
> + pl->supported, true))
> + return -EINVAL;
Are base.speed and base.duplex always set? When looking at
phy_ethtool_ksettings_set() the values are only used when base.autoneg
is false. So maybe they are not always valid?
Andrew