CVE-2025-38313 Overview
CVE-2025-38313 is a double-free vulnerability [CWE-415] in the Linux kernel's Freescale Management Complex (fsl-mc) bus driver. The flaw affects the deallocation logic for the mc_dev variable when the Management Complex device is a Data Path Resource Container (DPRC). A prior simplification of the deallocation path introduced an incorrect free of memory already released, corrupting kernel heap state.
Successful exploitation requires local access and low privileges, and can lead to memory corruption, kernel crashes, or privilege escalation on affected systems.
Critical Impact
A local, low-privileged user can trigger memory corruption in the kernel through the fsl-mc bus driver error path, enabling denial of service or potential privilege escalation.
Affected Products
- Linux Kernel (multiple stable branches — see referenced Git commits)
- Debian Linux 11 (Bullseye)
- Systems using the Freescale/NXP Management Complex (fsl-mc) bus driver
Discovery Timeline
- 2025-07-10 - CVE-2025-38313 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-38313
Vulnerability Analysis
The vulnerability resides in the fsl-mc bus driver, which manages Freescale/NXP DPAA2 (Data Path Acceleration Architecture) hardware objects on Layerscape SoCs. The driver represents devices using an mc_dev structure, and when a device is a DPRC it allocates a larger mc_bus container whose embedded field is exposed as mc_dev.
A prior commit refactored the error-path deallocation logic and freed both mc_bus and mc_dev separately. Because mc_dev is a reference to a field inside mc_bus, releasing both frees the same memory region twice. This double-free [CWE-415] corrupts kernel slab allocator metadata and can be leveraged to influence subsequent allocations.
Root Cause
The root cause is incorrect ownership semantics on the error path. When the MC device is a DPRC, only the parent mc_bus allocation is owned by the caller. The fix restores the conditional kfree(mc_bus) and removes the erroneous free of mc_dev, ensuring exactly one deallocation per allocation.
Attack Vector
Exploitation requires local access to a system with the fsl-mc bus driver loaded, typical of NXP Layerscape platforms. A low-privileged user or process that can trigger the driver's device probe error path can force the double-free. Reliable exploitation depends on grooming the SLUB allocator to place attacker-controlled objects into the freed slot, a well-documented technique for turning double-free primitives into use-after-free and ultimately kernel code execution.
No verified public proof-of-concept exists. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog, and the EPSS score remains low, indicating limited current exploitation likelihood.
Detection Methods for CVE-2025-38313
Indicators of Compromise
- Kernel oops or panic messages referencing fsl-mc, fsl_mc_bus, or fsl_mc_object_allocator in dmesg or /var/log/kern.log.
- SLUB debug warnings such as double free detected in cache or Object already free tied to fsl_mc allocations.
- Unexpected kernel crashes on NXP Layerscape or DPAA2-based hardware during device probe or removal cycles.
Detection Strategies
- Inventory Linux hosts to identify kernels earlier than the fixed stable releases referenced in the kernel.org commits (12e4431e, 1d5baab3, 3135e03a, 4b23c46e, 7002b954, 873d4711, b2057374, d694bf8a).
- Enable CONFIG_SLUB_DEBUG and CONFIG_KASAN in test environments to surface double-free conditions during driver stress testing.
- Correlate kernel crash telemetry with hardware profiles that include the fsl-mc bus to prioritize triage.
Monitoring Recommendations
- Forward kernel logs to a centralized logging or SIEM platform and alert on fsl-mc module warnings and BUG traces.
- Monitor for repeated device probe failures on DPRC objects, which may precede exploitation attempts.
- Track kernel package versions across the fleet and flag hosts running unpatched kernel branches.
How to Mitigate CVE-2025-38313
Immediate Actions Required
- Apply the latest stable Linux kernel updates from your distribution vendor that include the upstream fix commits listed on kernel.org.
- For Debian systems, install the kernel updates referenced in the Debian LTS Announcement 2025-07 and Debian LTS Announcement 2025-08.
- Restrict local shell access on NXP Layerscape and DPAA2-based systems to trusted administrators until patches are applied.
Patch Information
The fix restores conditional freeing of the mc_bus allocation and removes the erroneous free of the embedded mc_dev reference. Upstream patches are available in the mainline and stable trees. Reference commits: 12e4431e, 1d5baab3, 3135e03a, 4b23c46e, 7002b954, 873d4711, b2057374, and d694bf8a.
Workarounds
- On systems that do not require Freescale/NXP Management Complex support, blacklist the fsl_mc_bus kernel module to eliminate the vulnerable code path.
- Enforce least-privilege on local accounts and remove shell access from service accounts that do not require it.
- Enable kernel hardening features such as slab_freelist_hardened and init_on_free=1 to raise the cost of double-free exploitation.
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

