[PATCH v1 12/30] ACPICA: executer: Add bounds checking for PCC field write access

From: Pawel Chmielewski

Date: Tue Oct 20 2026 - 10:18:49 EST


From: ikaros <void0red@xxxxxxxxx>

Add validation in AcpiExWriteDataToField to ensure that PCC field
writes do not exceed the bounds of the InternalPccBuffer. Check for
a NULL buffer pointer and verify that BaseByteOffset + field byte
length does not exceed Region.Length.

Link: https://github.com/acpica/acpica/commit/1cba59bce8e0
Closes: https://github.com/open-acpica/acpica/issues/1175
Signed-off-by: ikaros <void0red@xxxxxxxxx>
Signed-off-by: Pawel Chmielewski <pawel.chmielewski@xxxxxxxxx>
---
drivers/acpi/acpica/exfield.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index b9da19ffcd3e..937da115c375 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -346,10 +346,28 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
* implementation will use the offsets specified rather than the name
* of the field. This is considered safer because some firmware tools
* are known to obfiscate named objects.
+ *
+ * Ensure the field access does not exceed the bounds of the
+ * internal_pcc_buffer.
*/
data_length =
(acpi_size)ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.
bit_length);
+
+ if (!obj_desc->field.region_obj->field.internal_pcc_buffer) {
+ return_ACPI_STATUS(AE_AML_NO_OPERAND);
+ }
+
+ if (obj_desc->field.base_byte_offset + data_length >
+ obj_desc->field.region_obj->region.length) {
+ ACPI_ERROR((
+ AE_INFO,
+ "PCC field at offset %u length %u exceeds region size %u",
+ obj_desc->field.base_byte_offset, data_length,
+ obj_desc->field.region_obj->region.length));
+ return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
+ }
+
memcpy(obj_desc->field.region_obj->field.internal_pcc_buffer +
obj_desc->field.base_byte_offset,
source_desc->buffer.pointer, data_length);
--
2.50.1