summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-core-priv.h
diff options
context:
space:
mode:
authorSean Young2018-04-12 22:28:39 +0200
committerMauro Carvalho Chehab2018-04-20 15:20:45 +0200
commit53a62800efb2f0ebc1972cab242461ae8c57bfd4 (patch)
tree1b5e63dc0512e83a27e907582e69ac8bf2c952cc /drivers/media/rc/rc-core-priv.h
parentmedia: rc: mce_kbd decoder: remove superfluous call to input_sync (diff)
downloadkernel-qcow2-linux-53a62800efb2f0ebc1972cab242461ae8c57bfd4.tar.gz
kernel-qcow2-linux-53a62800efb2f0ebc1972cab242461ae8c57bfd4.tar.xz
kernel-qcow2-linux-53a62800efb2f0ebc1972cab242461ae8c57bfd4.zip
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>
Diffstat (limited to 'drivers/media/rc/rc-core-priv.h')
-rw-r--r--drivers/media/rc/rc-core-priv.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index f78551344eca..07ba77fe6a3b 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -105,6 +105,8 @@ struct ir_raw_event_ctrl {
} sharp;
struct mce_kbd_dec {
struct input_dev *idev;
+ /* locks key up timer */
+ spinlock_t keylock;
struct timer_list rx_timeout;
char name[64];
char phys[64];