Subject: CVE-2024-33619: efi: libstub: only free priv.runtime_map when allocated

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

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

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

efi: libstub: only free priv.runtime_map when allocated

priv.runtime_map is only allocated when efi_novamap is not set.
Otherwise, it is an uninitialized value.  In the error path, it is freed
unconditionally.  Avoid passing an uninitialized value to free_pool.
Free priv.runtime_map only when it was allocated.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

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

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

	Issue introduced in 6.1 with commit f80d26043af9 and fixed in 6.1.93 with commit b8938d6f570f
	Issue introduced in 6.1 with commit f80d26043af9 and fixed in 6.6.33 with commit 9dce01f386c9
	Issue introduced in 6.1 with commit f80d26043af9 and fixed in 6.9.4 with commit 6ca67a5fe1c6
	Issue introduced in 6.1 with commit f80d26043af9 and fixed in 6.10 with commit 4b2543f7e1e6

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-33619
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/firmware/efi/libstub/fdt.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/b8938d6f570f010a1dcdbfed3e5b5d3258c2a908
	https://git.kernel.org/stable/c/9dce01f386c9ce6990c0a83fa14b1c95330b037e
	https://git.kernel.org/stable/c/6ca67a5fe1c606d1fbe24c30a9fc0bdc43a18554
	https://git.kernel.org/stable/c/4b2543f7e1e6b91cfc8dd1696e3cdf01c3ac8974