]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: prodikeys: Check presence of pm->input_ep82
authorGünther Noack <gnoack@google.com>
Fri, 9 Jan 2026 10:58:08 +0000 (11:58 +0100)
committerJiri Kosina <jkosina@suse.com>
Sat, 10 Jan 2026 09:28:36 +0000 (10:28 +0100)
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>
drivers/hid/hid-prodikeys.c

index 74bddb2c3e82eb50964e22352d3d5f12b3953ae0..6e413df38358a424502c7d07d2054f0e85c51a88 100644 (file)
@@ -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)) {