# CVE-2025-38687: comedi: fix race between polling and detaching

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

- **Severity:** HIGH 7.3
- **CVSS:** 7.3 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: Required; 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.20% (percentile 6, 2026-11-28)
- **CWE:** CWE-362
- **Published:** 2025-09-04T15:32:41.702Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< fe67122ba781df44a1a9716eb1dfd751321ab512; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< cd4286123d6948ff638ea9cd5818ae4796d5d252; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< d85fac8729c9acfd72368faff1d576ec585e5c8f; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 0f989f9d05492028afd2bded4b42023c57d8a76e; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 017198079551a2a5cf61eae966af3c4b145e1f3b; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 71ca60d2e631cf9c63bcbc7017961c61ff04e419; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 5724e82df4f9a4be62908362c97d522d25de75dd; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2
- Anyone running Linux 3.14

## Description

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

comedi: fix race between polling and detaching

syzbot reports a use-after-free in comedi in the below link, which is
due to comedi gladly removing the allocated async area even though poll
requests are still active on the wait\_queue\_head inside of it. This can
cause a use-after-free when the poll entries are later triggered or
removed, as the memory for the wait\_queue\_head has been freed.  We need
to check there are no tasks queued on any of the subdevices' wait queues
before allowing the device to be detached by the \`COMEDI\_DEVCONFIG\`
ioctl.

Tasks will read-lock \`dev-\>attach\_lock\` before adding themselves to the
subdevice wait queue, so fix the problem in the \`COMEDI\_DEVCONFIG\` ioctl
handler by write-locking \`dev-\>attach\_lock\` before checking that all of
the subdevices are safe to be deleted.  This includes testing for any
sleepers on the subdevices' wait queues.  It remains locked until the
device has been detached.  This requires the \`comedi\_device\_detach()\`
function to be refactored slightly, moving the bulk of it into new
function \`comedi\_device\_detach\_locked()\`.

Note that the refactor of \`comedi\_device\_detach()\` results in
\`comedi\_device\_cancel\_all()\` now being called while \`dev-\>attach\_lock\`
is write-locked, which wasn't the case previously, but that does not
matter.

Thanks to Jens Axboe for diagnosing the problem and co-developing this
patch.

## Affected and fixed versions

- Linux: \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< fe67122ba781df44a1a9716eb1dfd751321ab512; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< cd4286123d6948ff638ea9cd5818ae4796d5d252; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< d85fac8729c9acfd72368faff1d576ec585e5c8f; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 0f989f9d05492028afd2bded4b42023c57d8a76e; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 017198079551a2a5cf61eae966af3c4b145e1f3b; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 71ca60d2e631cf9c63bcbc7017961c61ff04e419; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 5724e82df4f9a4be62908362c97d522d25de75dd; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2 (cvelist)
- Linux: 3.14 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2025-38687.md
Affected: Linux >= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, < fe67122ba781df44a1a9716eb1dfd751321ab512; >= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, < cd4286123d6948ff638ea9cd5818ae4796d5d252; >= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, < d85fac8729c9acfd72368faff1d576ec585e5c8f; >= 2f3fdcd7ce935f6f2899cea…
Fixed in: Linux 0f989f9d05492028afd2bded4b42023c57d8a76e, Linux 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4, Linux 017198079551a2a5cf61eae966af3c4b145e1f3b, Linux 71ca60d2e631cf9c63bcbc7017961c61ff04e419, Linux 5724e82df4f9a4be62908362c97d522d25de75dd, Linux 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2

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

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

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

High: CVSS 7.3 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.

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

Linux \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< fe67122ba781df44a1a9716eb1dfd751321ab512; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< cd4286123d6948ff638ea9cd5818ae4796d5d252; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< d85fac8729c9acfd72368faff1d576ec585e5c8f; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 0f989f9d05492028afd2bded4b42023c57d8a76e; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 017198079551a2a5cf61eae966af3c4b145e1f3b; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 71ca60d2e631cf9c63bcbc7017961c61ff04e419; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 5724e82df4f9a4be62908362c97d522d25de75dd; \>= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \< 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2; Linux 3.14.

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

Yes. Fixed in Linux 0f989f9d05492028afd2bded4b42023c57d8a76e, Linux 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4, Linux 017198079551a2a5cf61eae966af3c4b145e1f3b, Linux 71ca60d2e631cf9c63bcbc7017961c61ff04e419, Linux 5724e82df4f9a4be62908362c97d522d25de75dd, Linux 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2. Upgrade Linux to 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2 or later.

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

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/fe67122ba781df44a1a9716eb1dfd751321ab512>
- patch: <https://git.kernel.org/stable/c/cd4286123d6948ff638ea9cd5818ae4796d5d252>
- patch: <https://git.kernel.org/stable/c/d85fac8729c9acfd72368faff1d576ec585e5c8f>
- patch: <https://git.kernel.org/stable/c/0f989f9d05492028afd2bded4b42023c57d8a76e>
- patch: <https://git.kernel.org/stable/c/5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4>
- patch: <https://git.kernel.org/stable/c/017198079551a2a5cf61eae966af3c4b145e1f3b>
- patch: <https://git.kernel.org/stable/c/71ca60d2e631cf9c63bcbc7017961c61ff04e419>
- patch: <https://git.kernel.org/stable/c/5724e82df4f9a4be62908362c97d522d25de75dd>
- patch: <https://git.kernel.org/stable/c/35b6fc51c666fc96355be5cd633ed0fe4ccf68b2>
- 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-38687>

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