CVE-2026-64120: net: ethtool: fix NULL pointer dereference in phy_reply_size

Greg Kroah-Hartman <[email protected]>
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026071924-CVE-2026-64120-195a@gregkh>
From: Greg Kroah-Hartman <[email protected]>

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

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

net: ethtool: fix NULL pointer dereference in phy_reply_size

In phy_prepare_data(), several strings such as 'name', 'drvname',
'upstream_sfp_name', and 'downstream_sfp_name' are allocated using
kstrdup(). However, these allocations were not checked  for failure.

If kstrdup() fails for 'name', it returns NULL while the function
continues. This leads to a kernel NULL pointer dereference and panic
later in phy_reply_size() when it unconditionally calls strlen() on
the NULL pointer.

While other strings like 'upstream_sfp_name' might be checked before
access in certain code paths, failing to handle these allocations
consistently can lead to incomplete data reporting or hidden bugs.

Fix this by adding proper NULL checks for all kstrdup() calls in
phy_prepare_data() and implement a centralized error handling path
using goto labels to ensure all previously allocated resources are
freed on failure.

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


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

	Issue introduced in 6.16 with commit 9dd2ad5e92b962d1349a7541d167e8e214e49f95 and fixed in 6.18.34 with commit 61f53c1e58d68723bc1db10912a53f1991f08719
	Issue introduced in 6.16 with commit 9dd2ad5e92b962d1349a7541d167e8e214e49f95 and fixed in 7.0.11 with commit 3dbe20a3809347bacda890822e7ca013bd85a18c
	Issue introduced in 6.16 with commit 9dd2ad5e92b962d1349a7541d167e8e214e49f95 and fixed in 7.1 with commit 4908f1395fb1b832ceec11584af649874a2732ea

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-64120
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/61f53c1e58d68723bc1db10912a53f1991f08719
	https://git.kernel.org/stable/c/3dbe20a3809347bacda890822e7ca013bd85a18c
	https://git.kernel.org/stable/c/4908f1395fb1b832ceec11584af649874a2732ea
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.