Skip to content

Commit

Permalink
ACPICA: Harden _PRT repair code; check for minimum package length.
Browse files Browse the repository at this point in the history
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: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Bob Moore authored and Rafael J. Wysocki committed Feb 26, 2014
1 parent 61db45c commit 1c3c2a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/acpi/acpica/nsrepair2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down

0 comments on commit 1c3c2a5

Please sign in to comment.