From: Tristan Madani <tristmd@gmail.com>
To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org,
Marcus Folkesson <marcus.folkesson@gmail.com>,
"Derek J . Clark" <derekjohn.clark@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Tristan Madani <tristan@talencesecurity.com>,
stable@vger.kernel.org
Subject: [PATCH v2 8/8] HID: prodikeys: validate report size in raw_event callback
Date: Sun, 18 Oct 2026 22:03:44 +0000 [thread overview]
Message-ID: <20261018220344.1987142-9-tristmd@gmail.com> (raw)
In-Reply-To: <20261018220344.1987142-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
pcmidi_handle_report1() and pcmidi_handle_report4() read a 24-bit
bitmask from data[1..3] without verifying the report buffer is large
enough. Since hid-core invokes raw_event before validating the report
length in hid_report_raw_event(), the driver must check the buffer size
itself.
Add minimum size checks before calling pcmidi_handle_report1() and
pcmidi_handle_report4(). pcmidi_handle_report3() already handles
variable-length reports via its own size parameter and needs no
additional guard.
Fixes: 3a370ca1dcf8c ("HID: Prodikeys PC-MIDI HID Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/hid/hid-prodikeys.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index fba01e4fcab1c..925ca70f9cd4a 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -491,12 +491,16 @@ static int pcmidi_handle_report(
switch (report_id) {
case 0x01: /* midi keys (qwerty)*/
+ if (size < 4)
+ break;
ret = pcmidi_handle_report1(pm, data);
break;
case 0x03: /* midi keyboard (musical)*/
ret = pcmidi_handle_report3(pm, data, size);
break;
case 0x04: /* multimedia/midi keys (qwerty)*/
+ if (size < 4)
+ break;
ret = pcmidi_handle_report4(pm, data);
break;
}
--
2.47.3
prev parent reply other threads:[~2026-10-18 22:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 22:03 [PATCH v2 0/8] HID: validate report size in raw_event callbacks Tristan Madani
2026-10-18 22:03 ` [PATCH v2 1/8] HID: pxrc: validate report size in raw_event callback Tristan Madani
2026-10-18 22:03 ` [PATCH v2 2/8] HID: alps: validate report size in raw_event callbacks Tristan Madani
2026-10-18 22:03 ` [PATCH v2 3/8] HID: mcp2200: validate report size in raw_event callback Tristan Madani
2026-10-18 22:03 ` [PATCH v2 4/8] HID: cougar: " Tristan Madani
2026-10-18 22:03 ` [PATCH v2 5/8] HID: zydacron: " Tristan Madani
2026-10-18 22:03 ` [PATCH v2 6/8] HID: oxp: validate report size in raw_event callbacks Tristan Madani
2026-10-18 22:13 ` sashiko-bot
2026-10-18 22:03 ` [PATCH v2 7/8] HID: cp2112: validate report size in raw_event callback Tristan Madani
2026-10-18 22:03 ` Tristan Madani [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261018220344.1987142-9-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=bentiss@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tristan@talencesecurity.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox