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 07:10:37 +0000 (09:10 +0200)
commit01d41d7e7fc7eef99ae5b1065d9186f91ff099e7
treee279ebecf9b347862f112e83c30b6608eb6d0e13
parenta309c34e52abc173e65f5cacc96a08679c9dfa3f
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