Subject: CVE-2024-35992: phy: marvell: a3700-comphy: Fix out of bounds read

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

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

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

phy: marvell: a3700-comphy: Fix out of bounds read

There is an out of bounds read access of 'gbe_phy_init_fix[fix_idx].addr'
every iteration after 'fix_idx' reaches 'ARRAY_SIZE(gbe_phy_init_fix)'.

Make sure 'gbe_phy_init[addr]' is used when all elements of
'gbe_phy_init_fix' array are handled.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

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

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

	Issue introduced in 5.18 with commit 934337080c6c and fixed in 6.1.90 with commit 976df695f579
	Issue introduced in 5.18 with commit 934337080c6c and fixed in 6.6.30 with commit 610f175d2e16
	Issue introduced in 5.18 with commit 934337080c6c and fixed in 6.8.9 with commit 40406dfbc060
	Issue introduced in 5.18 with commit 934337080c6c and fixed in 6.9 with commit e4308bc22b9d

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-35992
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/phy/marvell/phy-mvebu-a3700-comphy.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/976df695f579bbb2914114b4e9974fe4ed1eb813
	https://git.kernel.org/stable/c/610f175d2e16fb2436ba7974b990563002c20d07
	https://git.kernel.org/stable/c/40406dfbc060503d2e0a9e637e98493c54997b3d
	https://git.kernel.org/stable/c/e4308bc22b9d46cf33165c9dfaeebcf29cd56f04