mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
HID: prodikeys: validate fixed-format MIDI reports
The HID core invokes raw_event callbacks before validating the report length. Prodikeys reports 0x01 and 0x04 are passed to handlers that always read bytes one through three, regardless of the supplied size. A truncated report can therefore cause an out-of-bounds read. Require four bytes for the two fixed-format reports. Keep report 0x03 on its existing variable-length path, which derives the number of note pairs from size and only accesses complete pairs. Commit47669bec44("HID: asus: refactor the two workqueues and init sequence") added the same kind of raw_event length validation to hid-asus. Fixes:3a370ca1dc("HID: Prodikeys PC-MIDI HID Driver") Cc: stable@vger.kernel.org Signed-off-by: Jiale Yao <yaojiale02@163.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
parent
1ae40774d3
commit
0ff37294c4
|
|
@ -772,8 +772,13 @@ static int pk_raw_event(struct hid_device *hdev, struct hid_report *report,
|
|||
if (report->id == data[0])
|
||||
switch (report->id) {
|
||||
case 0x01: /* midi keys (qwerty)*/
|
||||
case 0x03: /* midi keyboard (musical)*/
|
||||
case 0x04: /* extra/midi keys (qwerty)*/
|
||||
if (size < 4)
|
||||
break;
|
||||
ret = pcmidi_handle_report(pm, report->id,
|
||||
data, size);
|
||||
break;
|
||||
case 0x03: /* midi keyboard (musical)*/
|
||||
ret = pcmidi_handle_report(pm,
|
||||
report->id, data, size);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user