Subject: CVE-2024-49862: powercap: intel_rapl: Fix off by one in get_rpi()

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

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

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

powercap: intel_rapl: Fix off by one in get_rpi()

The rp->priv->rpi array is either rpi_msr or rpi_tpmi which have
NR_RAPL_PRIMITIVES number of elements.  Thus the > needs to be >=
to prevent an off by one access.

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

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

	Issue introduced in 6.5 with commit 98ff639a7289 and fixed in 6.6.54 with commit 288cbc505e20
	Issue introduced in 6.5 with commit 98ff639a7289 and fixed in 6.10.13 with commit 851e7f7f14a1
	Issue introduced in 6.5 with commit 98ff639a7289 and fixed in 6.11.2 with commit 6a34f3b0d7f1
	Issue introduced in 6.5 with commit 98ff639a7289 and fixed in 6.12-rc1 with commit 95f6580352a7

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-49862
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/powercap/intel_rapl_common.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/288cbc505e2046638c615c36357cb78bc9fee1e0
	https://git.kernel.org/stable/c/851e7f7f14a15f4e47b7d0f70d5c4a2b95b824d6
	https://git.kernel.org/stable/c/6a34f3b0d7f11fb6ed72da315fd2360abd9c0737
	https://git.kernel.org/stable/c/95f6580352a7225e619551febb83595bcb77ab17