aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/evregion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/evregion.c')
-rw-r--r--drivers/acpi/acpica/evregion.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 144cbb9b73bc..9957297d1580 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -314,6 +314,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
314{ 314{
315 union acpi_operand_object *handler_obj; 315 union acpi_operand_object *handler_obj;
316 union acpi_operand_object *obj_desc; 316 union acpi_operand_object *obj_desc;
317 union acpi_operand_object *start_desc;
317 union acpi_operand_object **last_obj_ptr; 318 union acpi_operand_object **last_obj_ptr;
318 acpi_adr_space_setup region_setup; 319 acpi_adr_space_setup region_setup;
319 void **region_context; 320 void **region_context;
@@ -341,6 +342,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
341 /* Find this region in the handler's list */ 342 /* Find this region in the handler's list */
342 343
343 obj_desc = handler_obj->address_space.region_list; 344 obj_desc = handler_obj->address_space.region_list;
345 start_desc = obj_desc;
344 last_obj_ptr = &handler_obj->address_space.region_list; 346 last_obj_ptr = &handler_obj->address_space.region_list;
345 347
346 while (obj_desc) { 348 while (obj_desc) {
@@ -438,6 +440,15 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
438 440
439 last_obj_ptr = &obj_desc->region.next; 441 last_obj_ptr = &obj_desc->region.next;
440 obj_desc = obj_desc->region.next; 442 obj_desc = obj_desc->region.next;
443
444 /* Prevent infinite loop if list is corrupted */
445
446 if (obj_desc == start_desc) {
447 ACPI_ERROR((AE_INFO,
448 "Circular handler list in region object %p",
449 region_obj));
450 return_VOID;
451 }
441 } 452 }
442 453
443 /* If we get here, the region was not in the handler's region list */ 454 /* If we get here, the region was not in the handler's region list */