Subject: CVE-2024-26598: KVM: arm64: vgic-its: Avoid potential UAF in LPI translation cache

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

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

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

KVM: arm64: vgic-its: Avoid potential UAF in LPI translation cache

There is a potential UAF scenario in the case of an LPI translation
cache hit racing with an operation that invalidates the cache, such
as a DISCARD ITS command. The root of the problem is that
vgic_its_check_cache() does not elevate the refcount on the vgic_irq
before dropping the lock that serializes refcount changes.

Have vgic_its_check_cache() raise the refcount on the returned vgic_irq
and add the corresponding decrement after queueing the interrupt.

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

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

	Fixed in 5.4.269 with commit d04acadb6490
	Fixed in 5.10.209 with commit ba7be6667408
	Fixed in 5.15.148 with commit 12c2759ab134
	Fixed in 6.1.75 with commit dba788e25f05
	Fixed in 6.6.14 with commit 65b201bf3e9a
	Fixed in 6.7.2 with commit dd3956a1b3dd
	Fixed in 6.8 with commit ad362fe07fec

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-26598
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:
	arch/arm64/kvm/vgic/vgic-its.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/d04acadb6490aa3314f9c9e087691e55de153b88
	https://git.kernel.org/stable/c/ba7be666740847d967822bed15500656b26bc703
	https://git.kernel.org/stable/c/12c2759ab1343c124ed46ba48f27bd1ef5d2dff4
	https://git.kernel.org/stable/c/dba788e25f05209adf2b0175eb1691dc89fb1ba6
	https://git.kernel.org/stable/c/65b201bf3e9af1b0254243a5881390eda56f72d1
	https://git.kernel.org/stable/c/dd3956a1b3dd11f46488c928cb890d6937d1ca80
	https://git.kernel.org/stable/c/ad362fe07fecf0aba839ff2cc59a3617bd42c33f