Index: utresrc.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utresrc.c (revision 74550) +++ drivers/bus/acpi/acpica/utilities/utresrc.c (working copy) @@ -476,6 +476,13 @@ { return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } + if (AmlLength == sizeof (AML_RESOURCE_END_TAG)) + { + ACPI_ERROR((AE_INFO, + "Unexpected AmlLength 0x%X", + AmlLength)); + return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); + } /* Point to the end of the resource template buffer */ @@ -505,8 +512,8 @@ if (UserFunction) { - Status = UserFunction (Aml, Length, Offset, - ResourceIndex, Context); + Status = UserFunction ( + Aml, Length, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -542,16 +549,18 @@ { *Context = Aml; } - - /* Check if buffer is defined to be longer than the resource length */ - + if (AmlLength > (Offset + Length)) { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); + ACPI_ERROR((AE_INFO, + "Invalid AmlLength passed 0x%X. End tag found at offset 0x%X with length 0x%X", + AmlLength, Offset, Length)); } - /* Normal exit */ - + /* + * Normal exit. Note: We allow the buffer to be larger than + * the resource template, as long as the END_TAG exists. + */ return_ACPI_STATUS (AE_OK); }