From bippy-d175d3acf727 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: <linux-cve-announce@vger.kernel.org>
Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: CVE-2024-27413: efi/capsule-loader: fix incorrect allocation size

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

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

efi/capsule-loader: fix incorrect allocation size

gcc-14 notices that the allocation with sizeof(void) on 32-bit architectures
is not enough for a 64-bit phys_addr_t:

drivers/firmware/efi/capsule-loader.c: In function 'efi_capsule_open':
drivers/firmware/efi/capsule-loader.c:295:24: error: allocation of insufficient size '4' for type 'phys_addr_t' {aka 'long long unsigned int'} with size '8' [-Werror=alloc-size]
  295 |         cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL);
      |                        ^

Use the correct type instead here.

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


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

	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 4.19.309 with commit 00cf21ac5260
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 5.4.271 with commit 950d4d74d311
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 5.10.212 with commit 537e3f49dbe8
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 5.15.151 with commit 4b73473c050a
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 6.1.81 with commit ddc547dd05a4
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 6.6.21 with commit 11aabd748785
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 6.7.9 with commit 62a5dcd9bd30
	Issue introduced in 4.15 with commit f24c4d478013 and fixed in 6.8 with commit fccfa646ef36
	Issue introduced in 4.14.13 with commit 95a362c9a689

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-27413
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/capsule-loader.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/00cf21ac526011a29fc708f8912da446fac19f7b
	https://git.kernel.org/stable/c/950d4d74d311a18baed6878dbfba8180d7e5dddd
	https://git.kernel.org/stable/c/537e3f49dbe88881a6f0752beaa596942d9efd64
	https://git.kernel.org/stable/c/4b73473c050a612fb4317831371073eda07c3050
	https://git.kernel.org/stable/c/ddc547dd05a46720866c32022300f7376c40119f
	https://git.kernel.org/stable/c/11aabd7487857b8e7d768fefb092f66dfde68492
	https://git.kernel.org/stable/c/62a5dcd9bd3097e9813de62fa6f22815e84a0172
	https://git.kernel.org/stable/c/fccfa646ef3628097d59f7d9c1a3e84d4b6bb45e
