Subject: CVE-2024-26942: net: phy: qcom: at803x: fix kernel panic with at8031_probe

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

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

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

net: phy: qcom: at803x: fix kernel panic with at8031_probe

On reworking and splitting the at803x driver, in splitting function of
at803x PHYs it was added a NULL dereference bug where priv is referenced
before it's actually allocated and then is tried to write to for the
is_1000basex and is_fiber variables in the case of at8031, writing on
the wrong address.

Fix this by correctly setting priv local variable only after
at803x_probe is called and actually allocates priv in the phydev struct.

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

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

	Issue introduced in 6.8 with commit 25d2ba94005f and fixed in 6.8.3 with commit a8a296ad9957
	Issue introduced in 6.8 with commit 25d2ba94005f and fixed in 6.9 with commit 6a4aee277740

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-26942
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/qcom/at803x.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/a8a296ad9957b845b89bcf48be1cf8c74875ecc3
	https://git.kernel.org/stable/c/6a4aee277740d04ac0fd54cfa17cc28261932ddc