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: I07178f49e14608647b1758866c3ef2cc3ff5ed7d
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/267736
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 357a02d..be1508c 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -707,7 +707,10 @@
 
 		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;
 				/*