CVE-2026-90024 in Linuxinfo

Summary

by MITRE • 09/16/2026

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

usb: gadget: midi2: Fix null-pointer dereference in f_midi2_free_ep_reqs

A null-pointer dereference occurs in f_midi2_free_ep_reqs() when attempting to clean up an endpoint that was never initialized.

When configuring the MIDI 2.0 gadget via configfs and setting the block direction to SNDRV_UMP_DIR_INPUT, the initialization of the midi1_ep_out endpoint is explicitly skipped during the gadget bind phase (f_midi2_bind()). As a result, the usb_ep->card field remains NULL.

Later, when the host sets the alternate setting, f_midi2_set_alt() unconditionally stops both the IN and OUT endpoints by calling f_midi2_stop_eps(), which in turn calls f_midi2_free_ep_reqs() for both endpoints. When f_midi2_free_ep_reqs() is called for the uninitialized midi1_ep_out, it attempts to dereference usb_ep->card to determine the number of requests to free, leading to a crash.

Fix this by using usb_ep->num_reqs instead of usb_ep->card->info.num_reqs in f_midi2_free_ep_reqs(). usb_ep->num_reqs is correctly set during f_midi2_init_ep() and remains 0 if the endpoint was never initialized, safely avoiding the loop. For consistency, apply the same change to f_midi2_alloc_ep_reqs().

Oops: general protection fault, probably for non-canonical address 0xdffffc00000000ee: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000770-0x0000000000000777]
... RIP: 0010:f_midi2_free_ep_reqs drivers/usb/gadget/function/f_midi2.c:1166 [inline]
RIP: 0010:f_midi2_stop_eps+0x28e/0x4d0 drivers/usb/gadget/function/f_midi2.c:1246 ... Call Trace: <TASK> f_midi2_set_alt+0x11c/0xf00 drivers/usb/gadget/function/f_midi2.c:1296 composite_setup+0x1ffd/0x3480 drivers/usb/gadget/composite.c:1933 configfs_composite_setup+0xbd/0x100 drivers/usb/gadget/configfs.c:1877

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 09/16/2026

The Linux kernel USB gadget subsystem contains a critical null-pointer dereference vulnerability within the MIDI 2.0 function driver, specifically in the f_midi2_free_ep_reqs routine. This flaw arises from an improper handling of endpoint initialization states during the configuration and teardown phases of the USB device emulation process. The vulnerability is triggered when a system administrator or automated tool configures a Linux-based USB gadget to emulate a MIDI 2.0 peripheral using the configfs interface. During this setup, if the block direction for the midi1_ep_out endpoint is explicitly set to SNDRV_UMP_DIR_INPUT, the driver intentionally skips the initialization of that specific endpoint during the f_midi2_bind phase. Consequently, critical data structures associated with this endpoint remain in their default state, leaving the usb_ep->card field as NULL rather than pointing to a valid sound card structure.

The operational impact manifests when the connected USB host device attempts to change the alternate setting for the gadget interface. This action triggers the f_midi2_set_alt function, which unconditionally invokes f_midi2_stop_eps to halt both input and output endpoints regardless of their initialization status. The stop routine subsequently calls f_midi2_free_ep_reqs to release any allocated endpoint requests. When this cleanup routine is executed for the uninitialized midi1_ep_out endpoint, it attempts to access usb_ep->card to determine the number of pending requests that need freeing by reading card->info.num_reqs. Because the card pointer was never initialized and remains NULL, this memory access results in a general protection fault or null-pointer dereference, causing an immediate kernel panic or system crash on affected systems running KASAN-enabled kernels where such faults are detected as critical errors.

From a technical perspective, this vulnerability is classified under CWE-476: NULL Pointer Dereference. The root cause lies in the lack of defensive programming practices regarding conditional checks for endpoint initialization before accessing member fields that depend on prior setup steps. In the context of cybersecurity frameworks like MITRE ATT&CK, while this specific instance does not represent a remote code execution vector exploitable by an external attacker without physical access to configure the gadget, it falls under patterns associated with Denial of Service (DoS) via resource exhaustion or system instability caused by improper state management. The flaw highlights risks in kernel-space drivers where assumptions about initialization order are violated due to specific configuration paths that bypass standard setup routines.

The resolution involves modifying f_midi2_free_ep_reqs and the related allocation routine f_midi2_alloc_ep_reqs to rely on usb_ep->num_reqs instead of dereferencing the potentially null card pointer. The num_reqs field is correctly initialized during the endpoint initialization phase, f_midi2_init_ep(), and defaults to zero if that initialization step was skipped due to configuration constraints. By checking this value directly, the code safely avoids entering loops or performing operations on uninitialized structures when the endpoint was never set up. This change ensures robustness against edge cases in device configuration where certain endpoints are disabled by design rather than through error conditions.

To mitigate similar vulnerabilities and ensure system stability, developers should always validate pointer validity before dereferencing fields that depend on prior initialization steps, particularly within interrupt context or hot-path functions like endpoint stop routines. System administrators configuring USB gadgets via configfs must be aware of the implications of disabling specific endpoints to avoid triggering undefined behavior in downstream cleanup logic. Regular auditing of kernel drivers for consistent state management and adherence to expected lifecycle phases is essential to prevent such null-pointer dereferences from causing service disruptions or system crashes in production environments relying on Linux-based embedded devices or USB gadget implementations.

Responsible

Linux

Reservation

09/11/2026

Disclosure

09/16/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!