* [PATCH] net: phy: only remove owned topology entries
@ 2026-10-28 5:03 Jiale Yao
2026-10-28 5:06 ` netdev-bot+sinfo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiale Yao @ 2026-10-28 5:03 UTC (permalink / raw)
To: Maxime Chevallier, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Christophe Leroy, netdev, linux-kernel
Cc: stable
phy_link_topo_add_phy() can fail to insert a PHY when its saved index is
already occupied. 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.
Fixes: 384968786909 ("net: phy: Introduce ethernet link topology representation")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/phy/phy_link_topology.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_link_topology.c
index 214ccce23cf6..175eef44cf54 100644
--- a/drivers/net/phy/phy_link_topology.c
+++ b/drivers/net/phy/phy_link_topology.c
@@ -185,6 +185,10 @@ void phy_link_topo_del_phy(struct net_device *dev,
if (!topo)
return;
+ pdn = xa_load(&topo->phys, phy->phyindex);
+ if (!pdn || pdn->phy != phy)
+ return;
+
list_for_each_entry(port, &phy->ports, head)
phy_link_topo_del_port(dev, port);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: only remove owned topology entries
2026-10-28 5:03 [PATCH] net: phy: only remove owned topology entries Jiale Yao
@ 2026-10-28 5:06 ` netdev-bot+sinfo
2026-10-28 7:10 ` Maxime Chevallier
2026-10-28 12:55 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-10-28 5:06 UTC (permalink / raw)
To: Jiale Yao
Cc: Maxime Chevallier, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Christophe Leroy, netdev, linux-kernel, stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by code inspection). If it was triggered please include
the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: only remove owned topology entries
2026-10-28 5:03 [PATCH] net: phy: only remove owned topology entries Jiale Yao
2026-10-28 5:06 ` netdev-bot+sinfo
@ 2026-10-28 7:10 ` Maxime Chevallier
2026-10-28 12:55 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Maxime Chevallier @ 2026-10-28 7:10 UTC (permalink / raw)
To: Jiale Yao, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Christophe Leroy, netdev, linux-kernel
Cc: stable
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: only remove owned topology entries
2026-10-28 5:03 [PATCH] net: phy: only remove owned topology entries Jiale Yao
2026-10-28 5:06 ` netdev-bot+sinfo
2026-10-28 7:10 ` Maxime Chevallier
@ 2026-10-28 12:55 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-10-28 12:55 UTC (permalink / raw)
To: Jiale Yao
Cc: Maxime Chevallier, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Christophe Leroy, netdev, linux-kernel, stable
On Wed, Oct 28, 2026 at 01:03:12PM +0800, Jiale Yao wrote:
> phy_link_topo_add_phy() can fail to insert a PHY when its saved index is
> already occupied.
How did you get into this state? It indicates there is another bug
somewhere which needs fixing. Fixing that bug is much more important.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-28 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 5:03 [PATCH] net: phy: only remove owned topology entries Jiale Yao
2026-10-28 5:06 ` netdev-bot+sinfo
2026-10-28 7:10 ` Maxime Chevallier
2026-10-28 12:55 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®