# CVE-2025-40316: drm/mediatek: Fix device use-after-free on unbind

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

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **Published:** 2025-12-08T00:46:43.210Z
- **Modified:** 2026-10-14T22:10:00.210Z

## Who should check

- Anyone running Linux \>= 7d98166183d627c0b9daca7672b2191fae0f8a03, \< a5a896f8315de358a2932e2c23c42d550256046a; \>= 31ce7c089b50c3d3056c37e0e25e7535e4428ae1, \< 0142fe895986addf35885b43440718e567121155; \>= 1f403699c40f0806a707a9a6eed3b8904224021a, \< 8ba827e09eb586e952d10e39406fa02d10bb591e; \>= 1f403699c40f0806a707a9a6eed3b8904224021a, \< 926d002e6d7e2f1fd5c1b53cf6208153ee7d380d; fae58d0155a979a8c414bbc12db09dd4b2f910d0; \>= 6.6.105, \< 6.6.117; \>= 6.12.45, \< 6.12.58; \>= 6.16.5, \< 6.17
- Anyone running Linux 6.17

## Description

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

drm/mediatek: Fix device use-after-free on unbind

A recent change fixed device reference leaks when looking up drm
platform device driver data during bind() but failed to remove a partial
fix which had been added by commit 80805b62ea5b ("drm/mediatek: Fix
kobject put for component sub-drivers").

This results in a reference imbalance on component bind() failures and
on unbind() which could lead to a user-after-free.

Make sure to only drop the references after retrieving the driver data
by effectively reverting the previous partial fix.

Note that holding a reference to a device does not prevent its driver
data from going away so there is no point in keeping the reference.

## Affected and fixed versions

- Linux: \>= 7d98166183d627c0b9daca7672b2191fae0f8a03, \< a5a896f8315de358a2932e2c23c42d550256046a; \>= 31ce7c089b50c3d3056c37e0e25e7535e4428ae1, \< 0142fe895986addf35885b43440718e567121155; \>= 1f403699c40f0806a707a9a6eed3b8904224021a, \< 8ba827e09eb586e952d10e39406fa02d10bb591e; \>= 1f403699c40f0806a707a9a6eed3b8904224021a, \< 926d002e6d7e2f1fd5c1b53cf6208153ee7d380d; fae58d0155a979a8c414bbc12db09dd4b2f910d0; \>= 6.6.105, \< 6.6.117; \>= 6.12.45, \< 6.12.58; \>= 6.16.5, \< 6.17 (cvelist)
- Linux: 6.17 (cvelist)

## Mitigation

- Upgrade Linux to 6.17 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-40316. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40316.md
Affected: Linux >= 7d98166183d627c0b9daca7672b2191fae0f8a03, < a5a896f8315de358a2932e2c23c42d550256046a; >= 31ce7c089b50c3d3056c37e0e25e7535e4428ae1, < 0142fe895986addf35885b43440718e567121155; >= 1f403699c40f0806a707a9a6eed3b8904224021a, < 8ba827e09eb586e952d10e39406fa02d10bb591e; >= 1f403699c40f0806a707a9a…
Fixed in: Linux 0142fe895986addf35885b43440718e567121155, Linux 8ba827e09eb586e952d10e39406fa02d10bb591e, Linux 926d002e6d7e2f1fd5c1b53cf6208153ee7d380d, Linux 6.6.117, Linux 6.12.58, Linux 6.17

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-40316 being exploited?

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

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

It has no CVSS score yet. Unknown.

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

Linux \>= 7d98166183d627c0b9daca7672b2191fae0f8a03, \< a5a896f8315de358a2932e2c23c42d550256046a; \>= 31ce7c089b50c3d3056c37e0e25e7535e4428ae1, \< 0142fe895986addf35885b43440718e567121155; \>= 1f403699c40f0806a707a9a6eed3b8904224021a, \< 8ba827e09eb586e952d10e39406fa02d10bb591e; \>= 1f403699c40f0806a707a9a6eed3b8904224021a, \< 926d002e6d7e2f1fd5c1b53cf6208153ee7d380d; fae58d0155a979a8c414bbc12db09dd4b2f910d0; \>= 6.6.105, \< 6.6.117; \>= 6.12.45, \< 6.12.58; \>= 6.16.5, \< 6.17; Linux 6.17.

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

Yes. Fixed in Linux 0142fe895986addf35885b43440718e567121155, Linux 8ba827e09eb586e952d10e39406fa02d10bb591e, Linux 926d002e6d7e2f1fd5c1b53cf6208153ee7d380d, Linux 6.6.117, Linux 6.12.58, Linux 6.17. Upgrade Linux to 6.17 or later.

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

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/a5a896f8315de358a2932e2c23c42d550256046a>
- other: <https://git.kernel.org/stable/c/0142fe895986addf35885b43440718e567121155>
- other: <https://git.kernel.org/stable/c/8ba827e09eb586e952d10e39406fa02d10bb591e>
- other: <https://git.kernel.org/stable/c/926d002e6d7e2f1fd5c1b53cf6208153ee7d380d>

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

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