Re: [PATCH net] net: phy: reject attach while the PHY driver is in transition

From: Maxime Chevallier

Date: Thu Sep 17 2026 - 08:10:24 EST


Hi,

On 9/14/26 22:42, Aleksei Sviridkin wrote:
> phy_remove() clears phydev->drv as its last act; the driver core
> clears d->driver only afterwards, in device_unbind_cleanup(). In that
> window phy_attach_direct() skips the genphy substitution, because
> d->driver is still set, and then dereferences the NULL phydev->drv in
> phy_drv_supports_irq().

[...]

> Verified on an MT7981 board (mtk_eth_soc GMAC, "MediaTek MT7981 PHY" at
> mdio-bus:00), 6.18.44, with a 200 ms msleep() added at the end of
> phy_remove() to hold the window open. Two images, identical except for
> this patch.

If you need to add msleep(200) in the core of the framework to trigger that,
this is net-next material.

Maxime