Re: [PATCH net] net: ethtool: phy: fix NULL link_topo dereference in phy_prepare_data()

From: Andrew Lunn

Date: Wed Nov 11 2026 - 08:46:36 EST


> Reaching the crash needs an IBM EMAC device with a fixed-link node, which
> was not available here, so the fix is verified by compilation and code
> inspection only.

There is another way to look at this. The MAC driver might be broken,
it is assigning ndev->phydev, which it should not. It needs to call
one of the helpers that get to phy_attach_direct(), which sets
ndev->phydev.

Are there other MAC drivers which assign ndev->phydev?

This NULL pointer dereference can be considered good, because it might
be pointing out a bug. So we might want to keep it.

Andrew