VYPR
Unrated severityNVD Advisory· Published Oct 15, 2025· Updated Apr 15, 2026

CVE-2025-39997

CVE-2025-39997

Description

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

ALSA: usb-audio: fix race condition to UAF in snd_usbmidi_free

The previous commit 0718a78f6a9f ("ALSA: usb-audio: Kill timer properly at removal") patched a UAF issue caused by the error timer.

However, because the error timer kill added in this patch occurs after the endpoint delete, a race condition to UAF still occurs, albeit rarely.

Additionally, since kill-cleanup for urb is also missing, freed memory can be accessed in interrupt context related to urb, which can cause UAF.

Therefore, to prevent this, error timer and urb must be killed before freeing the heap memory.

AI Insight

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

A race condition in the Linux kernel's ALSA USB-audio MIDI driver can lead to use-after-free (UAF) when freeing memory before killing timers and URBs.

Vulnerability

Overview

CVE-2025-39997 is a use-after-free (UAF) vulnerability in the Linux kernel's ALSA USB-audio MIDI subsystem, specifically in the snd_usbmidi_free function. The root cause is a race condition where the error timer and associated URBs are not properly cleaned up before heap memory is freed. A previous fix (commit 0718a78f6a9f) attempted to address a similar UAF by killing the timer at removal, but it placed the timer kill after the endpoint delete, leaving a window for a race condition to still occur. Additionally, the cleanup of URBs was missing entirely, allowing freed memory to be accessed in interrupt context [1][2][3].

Exploitation

An attacker with local access to the system can trigger the race condition by manipulating USB device hotplug or MIDI device operations. The vulnerability requires the ability to cause the USB audio device to be removed while MIDI operations are in progress. No special privileges beyond the ability to interact with USB devices are needed, but the attack is dependent on precise timing to hit the race window.

Impact

Successful exploitation leads to a use-after-free condition, which can result in memory corruption, system crash (denial of service), or potentially arbitrary code execution in kernel context. The UAF occurs when the freed memory is accessed by the error timer callback or URB completion handler, giving an attacker control over kernel memory.

Mitigation

The fix is included in the Linux kernel stable tree as commits af600e7f5526, dc4874366cf6, and 353d8c715cc9. These patches ensure that the error timer and all URBs are killed before freeing the heap memory, closing the race window. Users should apply the updated kernel version containing these commits.

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

Affected products

2

Patches

5

Vulnerability mechanics

Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.