mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: phy: fix timestamping lifetime after probe failure
@ 2026-11-18 10:33 Kimberly Morris
  2026-11-18 10:34 ` [PATCH net 1/2] net: phy: restore timestamping state on " Kimberly Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kimberly Morris @ 2026-11-18 10:33 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, florian.fainelli
  Cc: bcm-kernel-feedback-list, davem, edumazet, kuba, pabeni,
	richardcochran, netdev, linux-kernel, gregkh, w

Hello,

Following Greg's request for an applyable patch, this series addresses the
automatic PHY probe-failure lifetime path from the earlier report. It does
not rely on the root-only sysfs driver-unbind trigger.

A PHY driver can publish a devres-backed mii_timestamper before its probe
has completed. If a later probe step fails, driver-core cleanup frees the
owner while the phy_device can retain the published timestamping state. A
later generic-PHY fallback can then reach the freed object from
skb_defer_rx_timestamp(). Broadcom BCM54210E/BCM54213PE also leaves a
registered PHC backed by the same freed storage.

Patch 1 restores the timestamping state that existed before phy_probe().
Patch 2 adds the missing managed Broadcom PHC and timestamper cleanup.

I reproduced the first issue on an x86_64 KASAN kernel with a KUnit test
that registers a real mii_bus, phy_device and phy_driver, follows the real
failed-probe and devres cleanup paths, attaches the generic PHY driver, and
passes a non-PTP skb to skb_defer_rx_timestamp(). Before the fix KASAN
reported a slab use-after-free; after the fix the test passed without a
KASAN report.

Tested on:

  - upstream master 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
  - net/main 2a324a58a084c5cfd7e5a2f55e0786bee170a4a5

The submitted series is generated against current upstream master
63fdb511c27afcebce797e3db580b3534ddfa639. I have not tested it on physical
BCM54213PE hardware, and I am not claiming an attacker-controlled probe
failure, privilege escalation, or code execution.

Please let me know if the rollback belongs in individual PHY drivers rather
than phylib core.

Thank you.

Kimberly Morris (2):
  net: phy: restore timestamping state on probe failure
  net: phy: broadcom: release PTP clock with PHY devres

 drivers/net/phy/bcm-phy-ptp.c | 19 +++++++++++++++++++
 drivers/net/phy/phy_device.c  |  5 +++++
 2 files changed, 24 insertions(+)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-18 10:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 10:33 [PATCH net 0/2] net: phy: fix timestamping lifetime after probe failure Kimberly Morris
2026-11-18 10:34 ` [PATCH net 1/2] net: phy: restore timestamping state on " Kimberly Morris
2026-11-18 10:34 ` [PATCH net 2/2] net: phy: broadcom: release PTP clock with PHY devres Kimberly Morris
2026-11-18 10:38 ` [PATCH net 0/2] net: phy: fix timestamping lifetime after probe failure netdev-bot+sinfo
2026-11-18 10:57   ` Kimberly Morris

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®