]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ACPICA: Limit maximum time for Sleep() operator
authorBob Moore <robert.moore@intel.com>
Wed, 26 May 2010 03:22:41 +0000 (11:22 +0800)
committerLen Brown <len.brown@intel.com>
Sat, 12 Jun 2010 04:55:17 +0000 (00:55 -0400)
To prevent accidental deep sleeps, limit the maximum time that
Sleep() will sleep. Configurable, default maximum is two seconds.
ACPICA bugzilla 854.

http://www.acpica.org/bugzilla/show_bug.cgi?id=854

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/acpica/acconfig.h
drivers/acpi/acpica/exsystem.c

index 33181ad350d5e1be00982cec40f497f0c47aa2ae..b17d8de9f6ffd5c98b7f02f610c8bc0ce1248ace 100644 (file)
 
 #define ACPI_MAX_LOOP_ITERATIONS        0xFFFF
 
+/* Maximum sleep allowed via Sleep() operator */
+
+#define ACPI_MAX_SLEEP                  20000  /* Two seconds */
+
 /******************************************************************************
  *
  * ACPI Specification constants (Do not change unless the specification changes)
index 6d32e09327f17e35724839fa81dee69707867f1d..675aaa91a770f2a78d3e0f9e9ae134ccf95ae446 100644 (file)
@@ -201,6 +201,14 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long)
 
        acpi_ex_relinquish_interpreter();
 
+       /*
+        * For compatibility with other ACPI implementations and to prevent
+        * accidental deep sleeps, limit the sleep time to something reasonable.
+        */
+       if (how_long > ACPI_MAX_SLEEP) {
+               how_long = ACPI_MAX_SLEEP;
+       }
+
        acpi_os_sleep(how_long);
 
        /* And now we must get the interpreter again */