Subject: CVE-2024-47666: scsi: pm80xx: Set phy->enable_completion only when we wait for it

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

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

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

scsi: pm80xx: Set phy->enable_completion only when we wait for it

pm8001_phy_control() populates the enable_completion pointer with a stack
address, sends a PHY_LINK_RESET / PHY_HARD_RESET, waits 300 ms, and
returns. The problem arises when a phy control response comes late.  After
300 ms the pm8001_phy_control() function returns and the passed
enable_completion stack address is no longer valid. Late phy control
response invokes complete() on a dangling enable_completion pointer which
leads to a kernel crash.

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

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

	Fixed in 6.6.51 with commit 7b1d779647af
	Fixed in 6.10.10 with commit f14d3e1aa613
	Fixed in 6.11 with commit e4f949ef1516

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-47666
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/scsi/pm8001/pm8001_sas.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/7b1d779647afaea9185fa2f150b1721e7c1aae89
	https://git.kernel.org/stable/c/f14d3e1aa613311c744af32d75125e95fc8ffb84
	https://git.kernel.org/stable/c/e4f949ef1516c0d74745ee54a0f4882c1f6c7aea