From: luoxuanqiang <xuanqiang.luo@linux.dev>
To: netdev@vger.kernel.org, andrew@lunn.ch
Cc: kuba@kernel.org, richardcochran@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, maxime.chevallier@bootlin.com,
luoxuanqiang@kylinos.cn
Subject: Re: [PATCH net v5 4/4] net: phy: dp83640: fix per-bus clock lifetime
Date: Mon, 10 Aug 2026 22:29:00 +0800 [thread overview]
Message-ID: <5b8746d6-09e4-4a28-bdc3-e9a6012db5b4@linux.dev> (raw)
In-Reply-To: <20260810141511.73204-5-xuanqiang.luo@linux.dev>
在 2026/8/10 22:15, xuanqiang.luo@linux.dev 写道:
> From: Xuanqiang Luo <xuanqiang.luo@linux.dev>
>
> 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 <xuanqiang.luo@linux.dev>
Sorry, PATCH 4 was sent with the wrong author and Signed-off-by email
address. Both should use:
Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Thanks,
Xuanqiang
next prev parent reply other threads:[~2026-08-10 14:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 14:15 [PATCH net v5 0/4] net: phy: dp83640: fix shared clock lifetime and probe error cleanup xuanqiang.luo
2026-08-10 14:15 ` [PATCH net v5 1/4] net: phy: add PHY package locking helpers xuanqiang.luo
2026-08-10 14:15 ` [PATCH net v5 2/4] net: phy: dp83640: embed pin configuration in clock xuanqiang.luo
2026-08-10 14:15 ` [PATCH net v5 3/4] net: phy: dp83640: clear state after PTP registration failure xuanqiang.luo
2026-08-10 14:15 ` [PATCH net v5 4/4] net: phy: dp83640: fix per-bus clock lifetime xuanqiang.luo
2026-08-10 14:29 ` luoxuanqiang [this message]
2026-08-10 14:50 ` Andrew Lunn
2026-08-10 15:16 ` luoxuanqiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b8746d6-09e4-4a28-bdc3-e9a6012db5b4@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luoxuanqiang@kylinos.cn \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox