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

CVE-2025-40096

CVE-2025-40096

Description

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

drm/sched: Fix potential double free in drm_sched_job_add_resv_dependencies

When adding dependencies with drm_sched_job_add_dependency(), that function consumes the fence reference both on success and failure, so in the latter case the dma_fence_put() on the error path (xarray failed to expand) is a double free.

Interestingly this bug appears to have been present ever since commit ebd5f74255b9 ("drm/sched: Add dependency tracking"), since the code back then looked like this:

drm_sched_job_add_implicit_dependencies(): ... for (i = 0; i < fence_count; i++) { ret = drm_sched_job_add_dependency(job, fences[i]); if (ret) break; }

for (; i < fence_count; i++) dma_fence_put(fences[i]);

Which means for the failing 'i' the dma_fence_put was already a double free. Possibly there were no users at that time, or the test cases were insufficient to hit it.

The bug was then only noticed and fixed after commit 9c2ba265352a ("drm/scheduler: use new iterator in drm_sched_job_add_implicit_dependencies v2") landed, with its fixup of commit 4eaf02d6076c ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies").

At that point it was a slightly different flavour of a double free, which commit 963d0b356935 ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies harder") noticed and attempted to fix.

But it only moved the double free from happening inside the drm_sched_job_add_dependency(), when releasing the reference not yet obtained, to the caller, when releasing the reference already released by the former in the failure case.

As such it is not easy to identify the right target for the fixes tag so lets keep it simple and just continue the chain.

While fixing we also improve the comment and explain the reason for taking the reference and not dropping it.

AI Insight

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

Double-free vulnerability in drm_sched_job_add_resv_dependencies can lead to memory corruption and system crash.

Vulnerability

Description

A double-free vulnerability exists in the Linux kernel's DRM scheduler in drm_sched_job_add_resv_dependencies. The function drm_sched_job_add_dependency() consumes the fence reference on both success and failure. Consequently, when the xarray expansion fails, the subsequent dma_fence_put() on the error path results in a double free. This bug has been present since commit ebd5f74255b9 ("drm/sched: Add dependency tracking").[1][2]

Exploitation

Exploitation requires the ability to trigger job dependency addition in the DRM scheduler and induce a resource allocation failure (e.g., memory pressure). The vulnerability is locally exploitable, as it requires access to DRM subsystem operations, typically available to users with sufficient privileges to interact with graphics hardware.

Impact

A successful double free can lead to use-after-free conditions, potentially causing kernel crashes, memory corruption, or privilege escalation. The exact impact depends on system state and memory layout, but it poses a significant stability and security risk.

Mitigation

The vulnerability has been fixed in upstream Linux kernel commits, including those referenced in the advisory. Users and distributions should apply the latest stable kernel updates to remediate the issue.[1][2]

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.