]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Input: add safety guards to input_set_keycode()
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 13 Dec 2019 22:56:16 +0000 (14:56 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:03:38 +0000 (19:03 +0100)
commit4af47d3cc875e43a523f6d3b3edef2ca785ccf27
treee6258f216fa70d7c550c09dfc862382d9b5e88f7
parentfc0d59fe1d15f087d8c8fe3212b8176a0ea47aa9
Input: add safety guards to input_set_keycode()

commit cb222aed03d798fc074be55e59d9a112338ee784 upstream.

If we happen to have a garbage in input device's keycode table with values
too big we'll end up doing clear_bit() with offset way outside of our
bitmaps, damaging other objects within an input device or even outside of
it. Let's add sanity checks to the returned old keycodes.

Reported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com
Reported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/input/input.c