diff options
author | Bob Moore <robert.moore@intel.com> | 2013-03-08 13:19:38 +0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-12 03:45:03 +0400 |
commit | c13085e519e8984fede41fa3d6a5502523b10996 (patch) | |
tree | c993b660f58d41ab46b93c4a810517de6f9ab072 /drivers/acpi/acpica/rsxface.c | |
parent | f6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff) | |
download | linux-c13085e519e8984fede41fa3d6a5502523b10996.tar.xz |
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/rsxface.c')
-rw-r--r-- | drivers/acpi/acpica/rsxface.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 15d6eaef0e28..c0e5d2d3ce67 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c @@ -563,13 +563,19 @@ acpi_walk_resource_buffer(struct acpi_buffer * buffer, while (resource < resource_end) { - /* Sanity check the resource */ + /* Sanity check the resource type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { status = AE_AML_INVALID_RESOURCE_TYPE; break; } + /* Sanity check the length. It must not be zero, or we loop forever */ + + if (!resource->length) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + } + /* Invoke the user function, abort on any error returned */ status = user_function(resource, context); |