CVE-2026-64228: net: ethtool: phy: avoid NULL deref when PHY driver is unbound

Greg Kroah-Hartman <[email protected]> Fri, 24 Jul 2026 17:23:31 +0200
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026072418-CVE-2026-64228-064a@gregkh>
From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

net: ethtool: phy: avoid NULL deref when PHY driver is unbound

phydev->drv can become NULL while the phy_device is still attached to
its net_device, namely after the PHY driver is unbound via sysfs:

	echo <mdio_id> > /sys/bus/mdio_bus/drivers/<phy_drv>/unbind

phy_remove() clears phydev->drv but doesn't call phy_detach(), so the
phy_device stays in the link topology xarray and ethnl_req_get_phydev()
still hands it back. ETHTOOL_MSG_PHY_GET then oopses on:

	rep_data->drvname = kstrdup(phydev->drv->name, GFP_KERNEL);

drvname is already treated as optional by phy_reply_size(),
phy_fill_reply() and phy_cleanup_data(), so just skip the allocation
when there is no driver bound.

The Linux kernel CVE team has assigned CVE-2026-64228 to this issue.


Affected and fixed versions
===========================

	Issue introduced in 6.16 with commit 9dd2ad5e92b962d1349a7541d167e8e214e49f95 and fixed in 6.18.34 with commit 3586924625559e6f9876d726c80ff0a75f0d5849
	Issue introduced in 6.16 with commit 9dd2ad5e92b962d1349a7541d167e8e214e49f95 and fixed in 7.0.11 with commit 17fe2381f967d353183f374a1c0181a6d194158c
	Issue introduced in 6.16 with commit 9dd2ad5e92b962d1349a7541d167e8e214e49f95 and fixed in 7.1 with commit e3adf69f8eb121a9128c2b0029efd050d3649153

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2026-64228
will be updated if fixes are backported, please check that for the most
up to date information about this issue.


Affected files
==============

The file(s) affected by this issue are:
	net/ethtool/phy.c


Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/3586924625559e6f9876d726c80ff0a75f0d5849
	https://git.kernel.org/stable/c/17fe2381f967d353183f374a1c0181a6d194158c
	https://git.kernel.org/stable/c/e3adf69f8eb121a9128c2b0029efd050d3649153