summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/rslist.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2013-03-08 09:19:38 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-12 00:45:03 +0100
commitc13085e519e8984fede41fa3d6a5502523b10996 (patch)
treec993b660f58d41ab46b93c4a810517de6f9ab072 /drivers/acpi/acpica/rslist.c
parentf6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff)
downloadblackbird-op-linux-c13085e519e8984fede41fa3d6a5502523b10996.tar.gz
blackbird-op-linux-c13085e519e8984fede41fa3d6a5502523b10996.zip
ACPICA: Resource Mgr: Prevent infinite loops in resource walks
Add checks for zero-length resource descriptors in all code that loops through a resource descriptor list. This prevents possible infinite loops because the length is used to increment the traveral pointer and detect the end-of-descriptor. 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/acpica/rslist.c')
-rw-r--r--drivers/acpi/acpica/rslist.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index ee2e206fc6c8..6053aa182093 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -178,6 +178,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
return_ACPI_STATUS(AE_BAD_DATA);
}
+ /* Sanity check the length. It must not be zero, or we loop forever */
+
+ if (!resource->length) {
+ ACPI_ERROR((AE_INFO,
+ "Invalid zero length descriptor in resource list\n"));
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
+ }
+
/* Perform the conversion */
if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
OpenPOWER on IntegriCloud