Re: [PATCH] net: phy: only remove owned topology entries

From: Maxime Chevallier

Date: Wed Oct 28 2026 - 03:11:01 EST




On 10/28/26 06:03, Jiale Yao wrote:
> phy_link_topo_add_phy() can fail to insert a PHY when its saved index is
> already occupied.

It's unclear to me how this can happen in real life...

> Its caller may subsequently run the normal detach
> path. phy_link_topo_del_phy() then unconditionally removes the entry at
> that index, including its ports, even though the entry belongs to a
> different PHY.
>
> Look up the topology entry first and only remove the PHY and its ports
> when the entry belongs to the PHY being detached.

Maxime