Input: add bounds checking to input_set_capability()
authorJeff LaBundy <jeff@labundy.com>
Mon, 21 Mar 2022 04:55:27 +0000 (21:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 May 2022 06:39:48 +0000 (08:39 +0200)
commit3e6fa9e4a7a89d67e01424317f7a2e9551025022
treea12fe64688a6e888a2a81322ef124bb6f197055e
parent43554c35258a0e6265ace36d8850d0dfc65c54fe
Input: add bounds checking to input_set_capability()

[ Upstream commit 409353cbe9fe48f6bc196114c442b1cff05a39bc ]

Update input_set_capability() to prevent kernel panic in case the
event code exceeds the bitmap for the given event type.

Suggested-by: Tomasz Moń <tomasz.mon@camlingroup.com>
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Tomasz Moń <tomasz.mon@camlingroup.com>
Link: https://lore.kernel.org/r/20220320032537.545250-1-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/input/input.c