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:41:18 +0000 (08:41 +0200)
commit9cc62ef5ba044b315c8761942db184a2ef8ff005
tree6c32ab4e5b2fda4f3d165494c4a927930d43b662
parent9c4a3cecfa7617db0b1566d23cd5e988beb16e00
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