OSDN Git Service

[PATCH] range checking for sleep states sent to /proc/acpi/sleep
authorWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2006 22:42:43 +0000 (00:42 +0200)
committerMarcelo Tosatti <marcelo@dmt.cnet>
Wed, 21 Jun 2006 13:40:43 +0000 (10:40 -0300)
A range checking is missing in acpi_system_write_sleep() in kernel
2.4, and writing a large integer value to /proc/acpi/sleep will cause
an oops. I could reproduce one this way :

   # echo 0x800000 >/proc/acpi/sleep

Fix extracted from the PaX patch.

drivers/acpi/system.c

index a1e018c..26f7b68 100644 (file)
@@ -748,7 +748,7 @@ acpi_system_write_sleep (
        
        state = simple_strtoul(state_string, NULL, 0);
        
-       if (!system->states[state])
+       if (state >= ACPI_S_STATE_COUNT || !system->states[state])
                return_VALUE(-ENODEV);
 
        /*