CHROMIUM: sysrq: clear sysrq->active state on sysrq release

Set sysrq->active to false when the sysrq key gets released.

Without this change, if the alt key is kept pressed but
sysrq key is pressed & released, sysrq->active will stay
true and any subsequent keystroke will be mistakenly treated
as a magic sysrq key sequence.

Note that we will keep this as a CHROMIUM patch and not try to
upstream based on dtor's feedback:
From an upstream POV the previous behavior was intentional as not
all keyboards are able to report that many keys at once (see
Documentation/sysrq.txt), so we keep SysRq mode active as long as
ALT is being held.

BUG=chromium:471490
TEST=Verify that the following two tests pass:
1. hit alt-volup-x key combination three times within 5 seconds.
The first time Chrome should crash & restart. The third time the
system should reboot.
2. while keeping the alt key pressed, press & release the volup key.
Then press the 'x' key three times within 5 seconds. Chrome should
NOT crash/restart and the system should NOT reboot.

Change-Id: Ic73979cfed7c73462bd86e949f279b56b700825e
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/264198
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
This commit is contained in:
Sameer Nanda
2015-04-06 17:49:12 -07:00
committed by ChromeOS Commit Bot
parent 4729755dad
commit c93e7eefbb

View File

@@ -829,7 +829,10 @@ static bool sysrq_handle_keypress(struct sysrq_state *sysrq,
case KEY_SYSRQ:
case KEY_F10:
if (value == 1 && sysrq->alt != KEY_RESERVED) {
if (!value) {
/* sysrq is being released */
sysrq->active = false;
} else if (value == 1 && sysrq->alt != KEY_RESERVED) {
sysrq->active = true;
sysrq->alt_use = sysrq->alt;
/*