]> git.baikalelectronics.ru Git - kernel.git/commit
media: rc: mce_kbd decoder: fix race condition
authorSean Young <sean@mess.org>
Thu, 12 Apr 2018 20:28:39 +0000 (16:28 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 20 Apr 2018 13:20:45 +0000 (09:20 -0400)
commit1951983e54d5e185229ba7dc5739e25dd6fe09b5
tree1b5e63dc0512e83a27e907582e69ac8bf2c952cc
parent8b4c4514b6877f12210ca8b154934b7ff955d00d
media: rc: mce_kbd decoder: fix race condition

The MCE keyboard sends both key down and key up events. We have a timeout
handler mce_kbd_rx_timeout() in case the keyup event is never received;
however, this may race with new key down events from occurring.

The race is that key down scancode arrives and key down events are
generated. The timeout handler races this and generates key up events
straight afterwards. Since the keyboard generates scancodes every 100ms,
most likely the keys will be repeated 100ms later, and now we have new
key down events and the user sees duplicate key presses.

Reported-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/ir-mce_kbd-decoder.c
drivers/media/rc/rc-core-priv.h