summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorGünther Noack <gnoack@google.com>2026-01-09 13:58:08 +0300
committerSasha Levin <sashal@kernel.org>2026-03-04 15:21:39 +0300
commite7ac1cd823cd2e9fcbd5cb0b261d6d35dbb79341 (patch)
treeecf11e3b820b0eb56483554c42a0a81bb857f5a4 /drivers/hid
parent922bd3e498a4b8e445def6e6ffea2ad3682ad516 (diff)
downloadlinux-e7ac1cd823cd2e9fcbd5cb0b261d6d35dbb79341.tar.xz
HID: prodikeys: Check presence of pm->input_ep82
[ Upstream commit cee8337e1bad168136aecfe6416ecd7d3aa7529a ] Fake USB devices can send their own report descriptors for which the input_mapping() hook does not get called. In this case, pm->input_ep82 stays NULL, which leads to a crash later. This does not happen with the real device, but can be provoked by imposing as one. Cc: stable@vger.kernel.org Signed-off-by: Günther Noack <gnoack@google.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-prodikeys.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 3d08c190a935..af7366b37c07 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -378,6 +378,10 @@ static int pcmidi_handle_report4(struct pcmidi_snd *pm, u8 *data)
bit_mask = (bit_mask << 8) | data[2];
bit_mask = (bit_mask << 8) | data[3];
+ /* robustness in case input_mapping hook does not get called */
+ if (!pm->input_ep82)
+ return 0;
+
/* break keys */
for (bit_index = 0; bit_index < 24; bit_index++) {
if (!((0x01 << bit_index) & bit_mask)) {