lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260203175813.2175230-1-horms@kernel.org>
Date: Tue,  3 Feb 2026 17:58:13 +0000
From: Simon Horman <horms@...nel.org>
To: maxime.chevallier@...tlin.com
Cc: Simon Horman <horms@...nel.org>,
	christophe.leroy@...roup.eu,
	thomas.petazzoni@...tlin.com,
	andrew@...n.ch,
	kuba@...nel.org,
	mwojtas@...omium.org,
	kabel@...nel.org,
	linux-kernel@...r.kernel.org,
	pabeni@...hat.com,
	davem@...emloft.net,
	nicveronese@...il.com,
	hkallweit1@...il.com,
	linux@...linux.org.uk,
	edumazet@...gle.com,
	dimitri.fedrau@...bherr.com,
	herve.codina@...tlin.com,
	o.rempel@...gutronix.de,
	romain.gantois@...tlin.com,
	netdev@...r.kernel.org,
	daniel@...rotopia.org,
	vladimir.oltean@....com,
	f.fainelli@...il.com,
	kory.maincent@...tlin.com
Subject: Re: [net-next,v3,01/11] net: phy: phy_port: Correctly recompute the port's linkmodes

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: phy: phy_port: Correctly recompute the port's linkmodes

This commit fixes phy_port_update_supported() to properly filter linkmodes
instead of incorrectly or'ing medium-specific modes to the existing support.
It moves the medium iteration inside a check for empty port->supported.

Fixes: 589e934d2735 ("net: phy: Introduce PHY ports representation")

> diff --git a/drivers/net/phy/phy_port.c b/drivers/net/phy/phy_port.c
> --- a/drivers/net/phy/phy_port.c
> +++ b/drivers/net/phy/phy_port.c

[ ... ]

> @@ -132,6 +126,19 @@ void phy_port_update_supported(struct phy_port *port)
>  			port->pairs = max_t(int, port->pairs,
>  					    ethtool_linkmode_n_pairs(mode));
>
> +	if (linkmode_empty(port->supported)) {
> +		for_each_set_bit(i, &port->mediums,
> +				 __ETHTOOL_LINK_MEDIUM_LAST) {
> +			__ETHTOOL_DECLARE_LINK_MODE_MASK(med_supported) = {0};
> +
> +			phy_caps_medium_get_supported(med_supported, i,
> +						      port->pairs);
> +			linkmode_or(supported, supported, med_supported);
> +		}
> +
> +		linkmode_and(port->supported, port->supported, supported);
> +	}

Jakub Kicinski raised a concern in v2 about the AND operation when
port->supported starts empty. The v3 fix adds the
'if (linkmode_empty(port->supported))' check, but then still performs:

    linkmode_and(port->supported, port->supported, supported);

inside that block. Since we just confirmed port->supported is empty,
ANDing it with anything will always produce an empty result.

Should this be linkmode_copy() or linkmode_or() instead of linkmode_and()
when port->supported starts empty?

Reference: https://lore.kernel.org/all/20260130040009.707764-1-kuba@kernel.org/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ