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: <20250318235850.6411-2-ansuelsmth@gmail.com>
Date: Wed, 19 Mar 2025 00:58:37 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Christian Marangi <ansuelsmth@...il.com>,
	Daniel Golle <daniel@...rotopia.org>,
	netdev@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	upstream@...oha.com
Subject: [net-next PATCH 1/6] net: phylink: reset PCS-Phylink double reference on phylink_stop

On calling phylink_stop, the double reference between PCS and Phylink is
never reset. This is OK in the current rudimental implementation of PCS
as current PCS driver doesn't autonomously handle link termination (or
actually doesn't handle removal of the PCS driver at all)

But this immediately became problematic if the PCS driver makes use of
this double reference to track if the PCS have an actual user attached.
If a driver makes use of this and the double reference is not reset, the
driver might erroneously detect the PCS have a user and execute stop
operation even if not actually used. (causing unwanted link termination)

To permit PCS driver to detect this correctly, and to better handle this
similar to how it done with phylink_major_config, set to NULL the double
reference between PCS and Phylink on phylink_stop.

On phylink_major_config, PCS is always refreshed by calling
mac_select_pcs hence it's save to always reset it in phylink_stop.

Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
 drivers/net/phy/phylink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 76b1a329607b..eef1712ec22c 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2589,6 +2589,9 @@ void phylink_stop(struct phylink *pl)
 	pl->pcs_state = PCS_STATE_DOWN;
 
 	phylink_pcs_disable(pl->pcs);
+	if (pl->pcs)
+		pl->pcs->phylink = NULL;
+	pl->pcs = NULL;
 }
 EXPORT_SYMBOL_GPL(phylink_stop);
 
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ