Re: [PATCH net] net: phy: micrel: Fix potential shared PHC use-after-free
From: Andrew Lunn
Date: Sat Nov 07 2026 - 09:45:27 EST
On Sat, Nov 07, 2026 at 02:54:37PM +0800, Guangshuo Li wrote:
> The shared PHC outlives the first PHY's managed pin array and is not
> unregistered before the package data is freed. Subsequent PHC operations
> can therefore access released storage.
>
> Keep the pins at package scope and select a remaining PHY for register
> access when a member leaves. Unregister the clock before releasing its
> storage on the last member's exit. Pair each member's registration with
> cleanup that also runs on probe failure, and serialize clock access with
> member removal.
You fix looks overly complicated. Ugly.
Try looking at it from a different direction.
.probe() and .remove() should be opposites of each other. What happens
if you do that?
Andrew
---
pw-bot: cr