[PATCH v2 39/42] ACPICA: dispatcher: Fix zero size non-NULL PCC buffer pointer
From: Maciej Wieczor-Retman
Date: Fri Nov 20 2026 - 12:27:12 EST
Zero sized PCC buffers still get allocated, so they pass the null checks
and can cause writes to unallocated memory.
Skip the allocation if the region length is zero or the
AOPOBJ_DATA_VALID flag is not set as otherwise the disassembler will
emit warnings on every PCC Field().
Link: https://github.com/acpica/acpica/commit/0f58983617c2
Fixes: aa6ec56b574d ("ACPICA: ACPI 6.3: add PCC operation region support for AML interpreter")
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
---
drivers/acpi/acpica/dsfield.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 5d0dfe4ff8e8..d091453eea93 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -530,6 +530,18 @@ acpi_ds_create_field(union acpi_parse_object *op,
if (info.region_node->object->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_COMM &&
!region_node->object->field.internal_pcc_buffer) {
+ /*
+ * If AOPOBJ_DATA_VALID flag is not set the region operands is not
+ * evaluated (e.g. disassembler), nothing to allocate.
+ * Also avoid a zero-size allocation which may yield a non-NULL pointer
+ */
+
+ if (!(info.region_node->object->common.flags &
+ AOPOBJ_DATA_VALID) ||
+ (!info.region_node->object->region.length)) {
+ return_ACPI_STATUS(AE_OK);
+ }
+
region_node->object->field.internal_pcc_buffer =
ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
length);
--
2.56.0