Subject: CVE-2024-27047: net: phy: fix phy_get_internal_delay accessing an empty array

From: Greg Kroah-Hartman <[email-masked]>

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

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

net: phy: fix phy_get_internal_delay accessing an empty array

The phy_get_internal_delay function could try to access to an empty
array in the case that the driver is calling phy_get_internal_delay
without defining delay_values and rx-internal-delay-ps or
tx-internal-delay-ps is defined to 0 in the device-tree.
This will lead to "unable to handle kernel NULL pointer dereference at
virtual address 0". To avoid this kernel oops, the test should be delay
>= 0. As there is already delay < 0 test just before, the test could
only be size == 0.

The Linux kernel CVE team has assigned CVE-2024-27047 to this issue.

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

	Issue introduced in 5.9 with commit 92252eec913b and fixed in 5.10.214 with commit 06dd21045a7e
	Issue introduced in 5.9 with commit 92252eec913b and fixed in 5.15.153 with commit 0e939a002c8a
	Issue introduced in 5.9 with commit 92252eec913b and fixed in 6.1.83 with commit 2a2ff7095116
	Issue introduced in 5.9 with commit 92252eec913b and fixed in 6.6.23 with commit 589ec16174dd
	Issue introduced in 5.9 with commit 92252eec913b and fixed in 6.7.11 with commit c0691de7df1d
	Issue introduced in 5.9 with commit 92252eec913b and fixed in 6.8.2 with commit 0307cf443308
	Issue introduced in 5.9 with commit 92252eec913b and fixed in 6.9 with commit 4469c0c5b14a

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-2024-27047
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:
	drivers/net/phy/phy_device.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/06dd21045a7e8bc8701b0ebedcd9a30a6325878b
	https://git.kernel.org/stable/c/0e939a002c8a7d66e60bd0ea6b281fb39d713c1a
	https://git.kernel.org/stable/c/2a2ff709511617de9c6c072eeee82bcbbdfecaf8
	https://git.kernel.org/stable/c/589ec16174dd9378953b8232ae76fad0a96e1563
	https://git.kernel.org/stable/c/c0691de7df1d51482a52cac93b7fe82fd9dd296b
	https://git.kernel.org/stable/c/0307cf443308ecc6be9b2ca312bb31bae5e5a7ad
	https://git.kernel.org/stable/c/4469c0c5b14a0919f5965c7ceac96b523eb57b79