[PATCH v1 29/30] ACPICA: dispatcher: Allocate the PCC internal buffer only once per region

From: Pawel Chmielewski

Date: Tue Oct 20 2026 - 10:23:00 EST


From: Breno Leitao <leitao@xxxxxxxxxx>

AcpiDsCreateField() allocates InternalPccBuffer for operation regions in
the PCC address space. It runs once per Field() operator, so a second
Field() naming the same region overwrites the pointer and orphans the
buffer the first one allocated. The matching ACPI_FREE() in
AcpiUtDeleteInternalObj() only ever sees the last one.

Every field unit of a PCC region reads and writes through
RegionObj->Field.InternalPccBuffer, so one buffer per region is enough.
Skip the allocation when the region object already has one.

Reproduced with a table declaring two Field() operators on one PCC
region. Before, acpiexec reports the orphaned buffer at exit:

0x4a09b0 Length 0x00C0 dsfield-0705 [Not a Descriptor]
ACPI Error: 5 (0x5) Outstanding cache allocations

After, that allocation is gone and field access is unchanged.

On Linux, this is detected by kmemleak, as shown in [1].

Link: https://github.com/acpica/acpica/commit/c71849d476bb
Link: https://lore.kernel.org/all/20260813-acpica-pcc-field-leak-v1-1-3d6c5f0eb557@xxxxxxxxxx/ [1]
Link: https://github.com/open-acpica/acpica/pull/1218
Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Signed-off-by: Pawel Chmielewski <pawel.chmielewski@xxxxxxxxx>
---
drivers/acpi/acpica/dsfield.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index d916ff6dd501..28f8293da6a7 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -528,7 +528,8 @@ acpi_ds_create_field(union acpi_parse_object *op,
}

if (info.region_node->object->region.space_id ==
- ACPI_ADR_SPACE_PLATFORM_COMM) {
+ ACPI_ADR_SPACE_PLATFORM_COMM &&
+ !region_node->object->field.internal_pcc_buffer) {
region_node->object->field.internal_pcc_buffer =
ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
length);
--
2.50.1