Skip to content

Commit cee8337

Browse files
gnoackJiri Kosina
authored andcommitted
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>
1 parent 17abd39 commit cee8337

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/hid/hid-prodikeys.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,10 @@ static int pcmidi_handle_report4(struct pcmidi_snd *pm, u8 *data)
378378
bit_mask = (bit_mask << 8) | data[2];
379379
bit_mask = (bit_mask << 8) | data[3];
380380

381+
/* robustness in case input_mapping hook does not get called */
382+
if (!pm->input_ep82)
383+
return 0;
384+
381385
/* break keys */
382386
for (bit_index = 0; bit_index < 24; bit_index++) {
383387
if (!((0x01 << bit_index) & bit_mask)) {

0 commit comments

Comments
 (0)