Messages in this thread Patch in this message | | | Date | Fri, 21 Apr 2006 21:05:08 -0700 (PDT) | From | dean gaudet <> | Subject | [PATCH] off-by-1 in kernel/power/main.c |
| |
there's an off-by-1 in 2.6.16.9 (and 2.6.17-rc2) kernel/power/main.c:state_store() ... if your kernel just happens to have some non-zero data at pm_states[PM_SUSPEND_MAX] (i.e. one past the end of the array) then it'll let you write anything you want to /sys/power/state and in response the box will enter S5.
i randomly discovered this because i really wanted to put my box into S5 (for wake on lan) and tried "echo off >/sys/power/state" and was quite happy that the box entered S5... happy until i compiled a different kernel and this S5 trick stopped working :)
anyhow, this begs the question, what is the correct way to get a box to shutdown into s5? on a fc4 box i have here it does that happily, but ubuntu boxes don't seem to go into s5... and i couldn't figure out from fc4 patches if they'd changed anything in this area. pointers appreciated.
btw i can whip up a patch making "off" a valid value for /sys/power/state ...
-dean
Signed-off-by: dean gaudet <dean@arctic.org>
--- linux/kernel/power/main.c.orig 2006-03-19 21:53:29.000000000 -0800 +++ linux/kernel/power/main.c 2006-04-21 20:54:12.000000000 -0700 @@ -272,7 +272,7 @@ if (*s && !strncmp(buf, *s, len)) break; } - if (*s) + if (state < PM_SUSPEND_MAX && *s) error = enter_state(state); else error = -EINVAL; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |