usb: gadget: midi2: Fix the jack descriptor array sizes
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: midi2: Fix the jack descriptor array sizes
The jack in/out descriptor arrays in struct f_midi2_usb_config have the size of MAX_CABLES, which look reasonable -- but it turned out to be incorrect. Namely, the entries for those arrays are added from both inputs and outputs, hence for each loop cycle, it adds two, ended up with as twice as the expected size. This inconsistency may result in potential OOB when a large number of jacks are set up via configfs, although the max number of cables (the loop count) is limited to MAX_CABLES.
For addressing it, correct the jack_ins & jack_outs array sizes to twice, MAX_CABLES * 2.
From the CVE record · Linux
The USB gadget MIDI 2.0 jack descriptor arrays are too small for entries added from both inputs and outputs. Setting up a large number of jacks through configfs may cause an out-of-bounds access; the input does not specify authentication or user-interaction requirements.
Engineers running Linux kernels with the USB gadget MIDI 2.0 component should check their versions against the vendor advisory; affected versions are not specified.