# CVE-2025-40096: drm/sched: Fix potential double free in drm\_sched\_job\_add\_resv\_dependencies

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.24% (percentile 9, 2026-11-26)
- **Published:** 2025-10-30T09:48:03.954Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 4c38a63ae12ecc9370a7678077bde2d61aa80e9c; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 57239762aa90ad768dac055021f27705dae73344; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< e5e3eb2aff92994ee81ce633f1c4e73bd4b87e11; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< fdfb47e85af1e11ec822c82739dde2dd8dff5115; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 5801e65206b065b0b2af032f7f1eef222aa2fd83
- Anyone running Linux 5.16

## 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.

## Affected and fixed versions

- Linux: \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 4c38a63ae12ecc9370a7678077bde2d61aa80e9c; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 57239762aa90ad768dac055021f27705dae73344; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< e5e3eb2aff92994ee81ce633f1c4e73bd4b87e11; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< fdfb47e85af1e11ec822c82739dde2dd8dff5115; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 5801e65206b065b0b2af032f7f1eef222aa2fd83 (cvelist)
- Linux: 5.16 (cvelist)

## Mitigation

- Upgrade Linux to 5801e65206b065b0b2af032f7f1eef222aa2fd83 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-40096. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40096.md
Affected: Linux >= 963d0b3569354230f6e2c36a286ef270a8901878, < 4c38a63ae12ecc9370a7678077bde2d61aa80e9c; >= 963d0b3569354230f6e2c36a286ef270a8901878, < 57239762aa90ad768dac055021f27705dae73344; >= 963d0b3569354230f6e2c36a286ef270a8901878, < e5e3eb2aff92994ee81ce633f1c4e73bd4b87e11; >= 963d0b3569354230f6e2c36…
Fixed in: Linux 4c38a63ae12ecc9370a7678077bde2d61aa80e9c, Linux 57239762aa90ad768dac055021f27705dae73344, Linux 5801e65206b065b0b2af032f7f1eef222aa2fd83

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-40096 being exploited?

There is no confirmed exploitation: CVE-2025-40096 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.24% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-40096?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-40096?

Linux \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 4c38a63ae12ecc9370a7678077bde2d61aa80e9c; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 57239762aa90ad768dac055021f27705dae73344; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< e5e3eb2aff92994ee81ce633f1c4e73bd4b87e11; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< fdfb47e85af1e11ec822c82739dde2dd8dff5115; \>= 963d0b3569354230f6e2c36a286ef270a8901878, \< 5801e65206b065b0b2af032f7f1eef222aa2fd83; Linux 5.16.

### Is there a fix for CVE-2025-40096?

Yes. Fixed in Linux 4c38a63ae12ecc9370a7678077bde2d61aa80e9c, Linux 57239762aa90ad768dac055021f27705dae73344, Linux 5801e65206b065b0b2af032f7f1eef222aa2fd83. Upgrade Linux to 5801e65206b065b0b2af032f7f1eef222aa2fd83 or later.

### How do I check if I'm affected by CVE-2025-40096?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/4c38a63ae12ecc9370a7678077bde2d61aa80e9c>
- other: <https://git.kernel.org/stable/c/57239762aa90ad768dac055021f27705dae73344>
- other: <https://git.kernel.org/stable/c/e5e3eb2aff92994ee81ce633f1c4e73bd4b87e11>
- other: <https://git.kernel.org/stable/c/fdfb47e85af1e11ec822c82739dde2dd8dff5115>
- other: <https://git.kernel.org/stable/c/5801e65206b065b0b2af032f7f1eef222aa2fd83>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-40096>

HTML: <https://flawdb.com/CVE-2025-40096> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-40096>
