summaryrefslogtreecommitdiff
path: root/source/components/events/evregion.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2014-02-13 08:32:18 -0800
committerRobert Moore <Robert.Moore@intel.com>2014-02-13 08:32:18 -0800
commit0e88479c988c0e8e76a63338bfc09bf8a7c06a58 (patch)
treeb54bdc3546f6c972e40b2471192baa204df39c98 /source/components/events/evregion.c
parentea9a2c4024a0b785b30a48e97e01b6d8d67863a7 (diff)
downloadacpica-0e88479c988c0e8e76a63338bfc09bf8a7c06a58.tar.gz
Prevent infinite loops when traversing corrupted lists.
This change hardens the ACPICA code to detect circular linked object lists and prevent an infinite loop if such corruption exists.
Diffstat (limited to 'source/components/events/evregion.c')
-rw-r--r--source/components/events/evregion.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c
index c03ae6c81..8f1b24b2d 100644
--- a/source/components/events/evregion.c
+++ b/source/components/events/evregion.c
@@ -405,6 +405,7 @@ AcpiEvDetachRegion(
{
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *StartDesc;
ACPI_OPERAND_OBJECT **LastObjPtr;
ACPI_ADR_SPACE_SETUP RegionSetup;
void **RegionContext;
@@ -435,6 +436,7 @@ AcpiEvDetachRegion(
/* Find this region in the handler's list */
ObjDesc = HandlerObj->AddressSpace.RegionList;
+ StartDesc = ObjDesc;
LastObjPtr = &HandlerObj->AddressSpace.RegionList;
while (ObjDesc)
@@ -529,6 +531,16 @@ AcpiEvDetachRegion(
LastObjPtr = &ObjDesc->Region.Next;
ObjDesc = ObjDesc->Region.Next;
+
+ /* Prevent infinite loop if list is corrupted */
+
+ if (ObjDesc == StartDesc)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Circular handler list in region object %p",
+ RegionObj));
+ return_VOID;
+ }
}
/* If we get here, the region was not in the handler's region list */