|
@@ -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);
|