🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Oleksij Rempel Wed, 21 Oct 2026 09:17
Re: [PATCH net v2 05/14] net: pse-pd: do not reach a freed PHY from the notification worker
#5935
Author: Oleksij Rempel
Date: Wed, 21 Oct 2026 09:17
37 lines
12862 bytes
CCing: Maxime Chevallier <maxime.chevallier@bootlin.com>
for phy_port part.

On Tue, Oct 20, 2026 at 07:12:40PM +0200, Carlo Szelinsky wrote:
> The notification worker holds a reference on the pse_control, but not
> on the PHY that psec->attached_phydev points to. If the PHY is removed
> while the worker runs, the pse_control survives and the worker reads the
> freed PHY. The same happens without a race when two PHYs share one PI:
> attached_phydev keeps pointing at the first PHY after it is removed.
> 
> pse_control_put() unlinks and frees a pse_control under pse_list_mutex,
> and phy_device_remove() calls it before the PHY is freed. So instead of
> taking a reference, let the worker look the pse_control up and use
> attached_phydev under pse_list_mutex. This nests pse_list_mutex inside
> rtnl; nothing under pse_list_mutex takes rtnl.
> 
> For a PI shared by two PHYs there is no single netdev to report to, so
> clear attached_phydev when a second PHY takes the pse_control, and warn.
> Events for that PI are then no longer reported, even after one PHY goes
> away. Failing the second PHY instead would fail its whole MDIO bus.

A PI shared by two PHYs on one connector is a rare setup and no in-tree
DT has one (prtt1c gives each PHY its own PI), so dropping its events is
fine for this fix.

If this is ever lifted, the PI should hang off the port rather than a
PHY: a PI powers a connector, and with phy_port
(Documentation/networking/phy-port.rst) net-next already has a port
object to attach it to. That is net-next work, not for this series.

Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads