Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c3c2a54 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki
Browse files

ACPICA: Harden _PRT repair code; check for minimum package length.



This change prevents a fault during the repair by checking up
front if the _PRT subpackage contains the minimum number of
elements (4).

Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 61db45ca
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -611,6 +611,7 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
	union acpi_operand_object **top_object_list;
	union acpi_operand_object **sub_object_list;
	union acpi_operand_object *obj_desc;
	union acpi_operand_object *sub_package;
	u32 element_count;
	u32 index;

@@ -620,7 +621,12 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
	element_count = package_object->package.count;

	for (index = 0; index < element_count; index++) {
		sub_object_list = (*top_object_list)->package.elements;
		sub_package = *top_object_list;
		sub_object_list = sub_package->package.elements;

		if (sub_package->package.count < 4) {	/* Minimum required element count */
			return (AE_OK);
		}

		/*
		 * If the BIOS has erroneously reversed the _PRT source_name (index 2)