diff options
| author | Günther Noack <gnoack@google.com> | 2026-01-09 11:58:08 +0100 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-01-10 10:28:36 +0100 |
| commit | cee8337e1bad168136aecfe6416ecd7d3aa7529a (patch) | |
| tree | 40e742dbc95b517dd683ee29bf50f3eb3c51a249 /drivers | |
| parent | 17abd396548035fbd6179ee1a431bd75d49676a7 (diff) | |
HID: prodikeys: Check presence of pm->input_ep82
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>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hid/hid-prodikeys.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index 74bddb2c3e82..6e413df38358 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)) { |
