Subject: CVE-2024-38603: drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset()

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

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

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

drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset()

pci_alloc_irq_vectors() allocates an irq vector. When devm_add_action()
fails, the irq vector is not freed, which leads to a memory leak.

Replace the devm_add_action with devm_add_action_or_reset to ensure
the irq vector can be destroyed when it fails.

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

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

	Issue introduced in 6.0 with commit 66637ab137b4 and fixed in 6.1.93 with commit 1491a01ef5a9
	Issue introduced in 6.0 with commit 66637ab137b4 and fixed in 6.6.33 with commit a7678a16c25b
	Issue introduced in 6.0 with commit 66637ab137b4 and fixed in 6.8.12 with commit 2fcffaaf529d
	Issue introduced in 6.0 with commit 66637ab137b4 and fixed in 6.9.3 with commit b1e86f1ef8fa
	Issue introduced in 6.0 with commit 66637ab137b4 and fixed in 6.10 with commit 582c1aeee0a9

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-38603
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/perf/hisilicon/hns3_pmu.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/1491a01ef5a98149048b12e208f6ed8e86ad10b9
	https://git.kernel.org/stable/c/a7678a16c25b6ece1667ac681e3e783ff3de7a6f
	https://git.kernel.org/stable/c/2fcffaaf529d5fe3fdc6c0ee65a6f266b74de782
	https://git.kernel.org/stable/c/b1e86f1ef8fa796f8935be392457639f3a907d91
	https://git.kernel.org/stable/c/582c1aeee0a9e73010cf1c4cef338709860deeb0