From: Yogita Urade <[email protected]>

The memory allocation function ACPI_ALLOCATE_ZEROED does not
guarantee a successful allocation, but the subsequent code
directly dereferences the pointer that receives it, which may
lead to null pointer dereference. To fix this issue, a null
pointer check should be added. If it is null, return exception
code AE_NO_MEMORY.

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2024-24856

Signed-off-by: Yogita Urade <[email protected]>
Signed-off-by: Steve Sakoman <[email protected]>
---
 .../acpica/acpica/CVE-2024-24856.patch        | 33 +++++++++++++++++++
 .../acpica/acpica_20211217.bb                 |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/acpica/acpica/CVE-2024-24856.patch

diff --git a/meta/recipes-extended/acpica/acpica/CVE-2024-24856.patch 
b/meta/recipes-extended/acpica/acpica/CVE-2024-24856.patch
new file mode 100644
index 0000000000..beb6a79c8e
--- /dev/null
+++ b/meta/recipes-extended/acpica/acpica/CVE-2024-24856.patch
@@ -0,0 +1,33 @@
+From 4d4547cf13cca820ff7e0f859ba83e1a610b9fd0 Mon Sep 17 00:00:00 2001
+From: Huai-Yuan Liu <[email protected]>
+Date: Tue, 4 Jun 2024 11:52:15 +0000
+Subject: [PATCH] check null return of ACPI_ALLOCATE_ZEROED in
+
+AcpiDbConvertToPackage ACPI_ALLOCATE_ZEROED may fails, Elements
+might be null and will cause null pointer dereference later.
+
+Signed-off-by: Huai-Yuan Liu <[email protected]>
+
+CVE: CVE-2024-24856
+Upstream-Status: Backport 
[https://github.com/acpica/acpica/commit/4d4547cf13cca820ff7e0f859ba83e1a610b9fd0]
+
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ source/components/debugger/dbconvert.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/source/components/debugger/dbconvert.c 
b/source/components/debugger/dbconvert.c
+index 55307d0..c17a5ab 100644
+--- a/source/components/debugger/dbconvert.c
++++ b/source/components/debugger/dbconvert.c
+@@ -354,6 +354,8 @@ AcpiDbConvertToPackage (
+
+     Elements = ACPI_ALLOCATE_ZEROED (
+         DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT));
++    if (!Elements)
++        return (AE_NO_MEMORY);
+
+     This = String;
+     for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++)
+--
+2.40.0
diff --git a/meta/recipes-extended/acpica/acpica_20211217.bb 
b/meta/recipes-extended/acpica/acpica_20211217.bb
index d1727c1dab..ec253b998f 100644
--- a/meta/recipes-extended/acpica/acpica_20211217.bb
+++ b/meta/recipes-extended/acpica/acpica_20211217.bb
@@ -16,7 +16,9 @@ COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
 
 DEPENDS = "m4-native flex-native bison-native"
 
-SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix-${PV}.tar.gz";
+SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix-${PV}.tar.gz \
+           file://CVE-2024-24856.patch \
+          "
 SRC_URI[sha256sum] = 
"2511f85828820d747fa3e2c3433d3a38c22db3d9c2fd900e1a84eb4173cb5992"
 
 UPSTREAM_CHECK_URI = "https://acpica.org/downloads";
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#201041): 
https://lists.openembedded.org/g/openembedded-core/message/201041
Mute This Topic: https://lists.openembedded.org/mt/106814993/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to