Re: [PATCH] off-by-1 in kernel/power/main.c

From: Pavel Machek
Date: Sat Apr 22 2006 - 17:39:37 EST


Hi!

> 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
> ...

Looks okay to me. Can you add acked-by: Pavel Machek and mail it to
akpm?

Valid way to power off machine is by shutdown -o now, and there's a
syscall to do that. It should not be done by /sys/power/state.

Pavel

--
Thanks for all the (sleeping) penguins.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/