VYPR
Medium severity5.5NVD Advisory· Published Mar 7, 2025· Updated May 12, 2026

CVE-2025-21835

CVE-2025-21835

Description

In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: f_midi: fix MIDI Streaming descriptor lengths

While the MIDI jacks are configured correctly, and the MIDIStreaming endpoint descriptors are filled with the correct information, bNumEmbMIDIJack and bLength are set incorrectly in these descriptors.

This does not matter when the numbers of in and out ports are equal, but when they differ the host will receive broken descriptors with uninitialized stack memory leaking into the descriptor for whichever value is smaller.

The precise meaning of "in" and "out" in the port counts is not clearly defined and can be confusing. But elsewhere the driver consistently uses this to match the USB meaning of IN and OUT viewed from the host, so that "in" ports send data to the host and "out" ports receive data from it.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

A bug in the Linux kernel's USB MIDI gadget driver causes incorrect descriptor lengths, leaking uninitialized stack memory when in and out port counts differ.

Vulnerability

Overview

In the Linux kernel's USB f_midi gadget driver, the bLength and bNumEmbMIDIJack fields in the MIDIStreaming endpoint descriptors are set incorrectly. While the MIDI jacks are properly configured, the descriptor lengths do not accurately reflect the actual number of embedded MIDI jacks. This flaw exists because the code uses a fixed or swapped value rather than correctly computing the field based on the distinct IN and OUT port counts.

Exploitation

Prerequisites

The vulnerability manifests when the number of IN ports and OUT ports differ. IN ports send data to the host, and OUT ports receive data from the host. When these counts are unequal, the descriptor for the smaller count will contain stale, uninitialized stack memory in the space where the correct values should have been written. No special privileges or authentication are needed to trigger the issue; the host simply enumerates the device and parses the descriptor.

Impact

An attacker controlling a USB host that connects to a device using the f_midi gadget could receive kernel stack memory that was never initialized. This information leak may expose sensitive data from the kernel's stack, potentially aiding in bypassing security mitigations like KASLR. The leak is limited to the size of the descriptor fields (a few bytes), but the contents could be attacker-controlled or contain pointers or other critical data.

Mitigation

The fix has been applied to the Linux kernel stable tree [2][3][4]. Users should update to a kernel version containing the commit 9f6860a9c113 or later. Affected products, such as the SIMATIC S7-1500 TM MFP - GNU/Linux subsystem, are listed in advisory SSA-265688 [1] as impacted by this and many other CVEs. No workaround other than a kernel update is available.

AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

64

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

11

News mentions

0

No linked articles in our index yet.