CVE-2025-38687

comedi: fix race between polling and detaching

7.3 high EPSS 0.14%

Published 4 Sep 2025 Updated 5 Aug 2026 CNA: Linux

Check your servers for CVE-2025-38687

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-38687 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Severity (CVSS)

7.3 high CVSS 3.1 from Linux (CNA)
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
Attack vector
local: the attacker needs local access, or a user has to open a prepared file
Attack complexity
low: an attack works without special conditions
Privileges required
low: the attacker needs an ordinary user account
User interaction
required: a user has to do something, such as open a link or a file
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.14%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 3.65% of all scored CVEs. Scores of 1 Dec 2026.

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before fe67122ba781df44a1a9716eb1dfd751321ab512
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before cd4286123d6948ff638ea9cd5818ae4796d5d252
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before d85fac8729c9acfd72368faff1d576ec585e5c8f
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before 0f989f9d05492028afd2bded4b42023c57d8a76e
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before 017198079551a2a5cf61eae966af3c4b145e1f3b
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before 71ca60d2e631cf9c63bcbc7017961c61ff04e419
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before 5724e82df4f9a4be62908362c97d522d25de75dd
affected from 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, before 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2
Other versions: unaffected
Linux
affected 3.14
unaffected before 3.14
unaffected from 5.4.297 up to and including 5.4.*
unaffected from 5.10.241 up to and including 5.10.*
unaffected from 5.15.190 up to and including 5.15.*
unaffected from 6.1.149 up to and including 6.1.*
unaffected from 6.6.103 up to and including 6.6.*
unaffected from 6.12.43 up to and including 6.12.*
unaffected from 6.15.11 up to and including 6.15.*
unaffected from 6.16.2 up to and including 6.16.*
unaffected 6.17 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-38687 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-38687

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2025-38687
trivy image --scanners vuln IMAGE | grep CVE-2025-38687

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2025-38687 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.