Re: [PATCH net v5 4/4] net: phy: dp83640: fix per-bus clock lifetime

luoxuanqiang <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <[email protected]>
在 2026/8/10 22:15, [email protected] 写道:
> From: Xuanqiang Luo <[email protected]>
>
> Commit 42e2a9e11a1d ("net: phy: dp83640: improve phydev and driver
> removal handling") moved per-bus clock cleanup from module exit to the
> remove path. This leaves two lifetime problems.
>
> dp83640_clock_get_bus() publishes a newly allocated clock before the
> driver allocates its per-PHY data and registers the PTP clock. If either
> operation fails, no PHY is bound and the remove callback cannot release
> the clock, leaking the clock and the MII bus device reference.
>
> The remove path can also free a clock after dropping clock_lock. A
> concurrent probe may already have found the clock under
> phyter_clocks_lock and be waiting for clock_lock, allowing it to acquire
> a freed mutex and access the freed clock.
>
> Use the PHY package infrastructure for the per-bus clock. PHY packages
> are tracked per MII bus, and the driver uses BROADCAST_ADDR as the
> package key so the DP83640 PHYs on the same bus share the same clock
> storage. Call phy_package_join() during probe and phy_package_leave() on
> probe errors and in remove.
>
> Serialize the one-time clock initialization with the package lock because
> phy_package_probe_once() elects an initializer but does not wait for
> initialization to finish.
>
> Fixes: 42e2a9e11a1d ("net: phy: dp83640: improve phydev and driver removal handling")
> Signed-off-by: Xuanqiang Luo <[email protected]>

Sorry, PATCH 4 was sent with the wrong author and Signed-off-by email
address. Both should use:

Xuanqiang Luo <[email protected]>

Thanks,
Xuanqiang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.