# CVE-2025-39713: media: rainshadow-cec: fix TOCTOU race condition in rain\_interrupt()

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

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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.19% (percentile 5, 2026-11-26)
- **CWE:** CWE-367
- **Published:** 2025-09-05T17:21:20.459Z
- **Modified:** 2026-11-05T22:17:28.297Z

## Who should check

- Anyone running Linux \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 2964dbe631fd21ad7873b1752b895548d3c12496; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 6aaef1a75985865d8c6c5b65fb54152060faba48; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< fbc81e78d75bf28972bc22b1599559557b1a1b83; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 3c3e33b7edca7a2d6a96801f287f9faeb684d655; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 1c2769dc80255824542ea5a4ff1a07dcdeb1603f; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< ed905fe7cba03cf22ae0b84cf1b73cd1c070423a; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< ff9dd3db6cd4c6b54a2ecbc58151bea4ec63bc59; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 7af160aea26c7dc9e6734d19306128cce156ec40
- Anyone running Linux 4.12

## Description

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

media: rainshadow-cec: fix TOCTOU race condition in rain\_interrupt()

In the interrupt handler rain\_interrupt(), the buffer full check on
rain-\>buf\_len is performed before acquiring rain-\>buf\_lock. This
creates a Time-of-Check to Time-of-Use (TOCTOU) race condition, as
rain-\>buf\_len is concurrently accessed and modified in the work
handler rain\_irq\_work\_handler() under the same lock.

Multiple interrupt invocations can race, with each reading buf\_len
before it becomes full and then proceeding. This can lead to both
interrupts attempting to write to the buffer, incrementing buf\_len
beyond its capacity (DATA\_SIZE) and causing a buffer overflow.

Fix this bug by moving the spin\_lock() to before the buffer full
check. This ensures that the check and the subsequent buffer modification
are performed atomically, preventing the race condition. An corresponding
spin\_unlock() is added to the overflow path to correctly release the
lock.

This possible bug was found by an experimental static analysis tool
developed by our team.

## Affected and fixed versions

- Linux: \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 2964dbe631fd21ad7873b1752b895548d3c12496; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 6aaef1a75985865d8c6c5b65fb54152060faba48; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< fbc81e78d75bf28972bc22b1599559557b1a1b83; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 3c3e33b7edca7a2d6a96801f287f9faeb684d655; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 1c2769dc80255824542ea5a4ff1a07dcdeb1603f; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< ed905fe7cba03cf22ae0b84cf1b73cd1c070423a; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< ff9dd3db6cd4c6b54a2ecbc58151bea4ec63bc59; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 7af160aea26c7dc9e6734d19306128cce156ec40 (cvelist)
- Linux: 4.12 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2025-39713.md
Affected: Linux >= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, < 2964dbe631fd21ad7873b1752b895548d3c12496; >= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, < 6aaef1a75985865d8c6c5b65fb54152060faba48; >= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, < fbc81e78d75bf28972bc22b1599559557b1a1b83; >= 0f314f6c2e77beb1a232be2…
Fixed in: Linux 2964dbe631fd21ad7873b1752b895548d3c12496, Linux 6aaef1a75985865d8c6c5b65fb54152060faba48, Linux 3c3e33b7edca7a2d6a96801f287f9faeb684d655, Linux 1c2769dc80255824542ea5a4ff1a07dcdeb1603f, Linux 7af160aea26c7dc9e6734d19306128cce156ec40

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

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

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

Medium: CVSS 4.7 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

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

Linux \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 2964dbe631fd21ad7873b1752b895548d3c12496; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 6aaef1a75985865d8c6c5b65fb54152060faba48; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< fbc81e78d75bf28972bc22b1599559557b1a1b83; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 3c3e33b7edca7a2d6a96801f287f9faeb684d655; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 1c2769dc80255824542ea5a4ff1a07dcdeb1603f; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< ed905fe7cba03cf22ae0b84cf1b73cd1c070423a; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< ff9dd3db6cd4c6b54a2ecbc58151bea4ec63bc59; \>= 0f314f6c2e77beb1a232be21dd6be4e1849ba5ac, \< 7af160aea26c7dc9e6734d19306128cce156ec40; Linux 4.12.

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

Yes. Fixed in Linux 2964dbe631fd21ad7873b1752b895548d3c12496, Linux 6aaef1a75985865d8c6c5b65fb54152060faba48, Linux 3c3e33b7edca7a2d6a96801f287f9faeb684d655, Linux 1c2769dc80255824542ea5a4ff1a07dcdeb1603f, Linux 7af160aea26c7dc9e6734d19306128cce156ec40. Upgrade Linux to 7af160aea26c7dc9e6734d19306128cce156ec40 or later.

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

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

- patch: <https://git.kernel.org/stable/c/2964dbe631fd21ad7873b1752b895548d3c12496>
- patch: <https://git.kernel.org/stable/c/6aaef1a75985865d8c6c5b65fb54152060faba48>
- patch: <https://git.kernel.org/stable/c/fbc81e78d75bf28972bc22b1599559557b1a1b83>
- patch: <https://git.kernel.org/stable/c/3c3e33b7edca7a2d6a96801f287f9faeb684d655>
- patch: <https://git.kernel.org/stable/c/1c2769dc80255824542ea5a4ff1a07dcdeb1603f>
- patch: <https://git.kernel.org/stable/c/ed905fe7cba03cf22ae0b84cf1b73cd1c070423a>
- patch: <https://git.kernel.org/stable/c/ff9dd3db6cd4c6b54a2ecbc58151bea4ec63bc59>
- patch: <https://git.kernel.org/stable/c/7af160aea26c7dc9e6734d19306128cce156ec40>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-032379.html>

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

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