Skip to content

Commit

Permalink
[PATCH] off-by-1 in kernel/power/main.c
Browse files Browse the repository at this point in the history
There's an off-by-1 in 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.

Signed-off-by: dean gaudet <dean@arctic.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
dean gaudet authored and Linus Torvalds committed Apr 28, 2006
1 parent 37e53db commit 47bb789
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n
if (*s && !strncmp(buf, *s, len))
break;
}
if (*s)
if (state < PM_SUSPEND_MAX && *s)
error = enter_state(state);
else
error = -EINVAL;
Expand Down

0 comments on commit 47bb789

Please sign in to comment.