aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2014-02-25 21:30:25 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-26 18:46:00 -0500
commit1c3c2a545dc06e606c6cbbcb7ab722bf3b2cb668 (patch)
tree25177257518931eb956e4eac4d116ff602304dcd /drivers/acpi
parent61db45ca21630f5ab7f678d54c5d969c21647854 (diff)
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: 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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/nsrepair2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 53b4b42a13f2..c57cd4aa357d 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -611,6 +611,7 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
611 union acpi_operand_object **top_object_list; 611 union acpi_operand_object **top_object_list;
612 union acpi_operand_object **sub_object_list; 612 union acpi_operand_object **sub_object_list;
613 union acpi_operand_object *obj_desc; 613 union acpi_operand_object *obj_desc;
614 union acpi_operand_object *sub_package;
614 u32 element_count; 615 u32 element_count;
615 u32 index; 616 u32 index;
616 617
@@ -620,7 +621,12 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
620 element_count = package_object->package.count; 621 element_count = package_object->package.count;
621 622
622 for (index = 0; index < element_count; index++) { 623 for (index = 0; index < element_count; index++) {
623 sub_object_list = (*top_object_list)->package.elements; 624 sub_package = *top_object_list;
625 sub_object_list = sub_package->package.elements;
626
627 if (sub_package->package.count < 4) { /* Minimum required element count */
628 return (AE_OK);
629 }
624 630
625 /* 631 /*
626 * If the BIOS has erroneously reversed the _PRT source_name (index 2) 632 * If the BIOS has erroneously reversed the _PRT source_name (index 2)