CVE-2025-38687
MediumIn 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.
CVSS 3.1 score
4.7
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
Weakness type
CWE-362CVE-2025-38687 is a Race Condition vulnerability
What is Race Condition?
The product contains a code sequence that can run concurrently with other code, creating unexpected states. Learn more on MITRE CWE
Affected versions
Linux kernel versions
3.14
and later are affected. Fixed in
5.4.297,
5.10.241,
5.15.190,
6.1.149,
6.6.103,
6.12.43,
6.15.11,
6.16.2,
6.17
and their respective stable series.
References
The following references provide additional information about CVE-2025-38687 including vendor advisories, patch commits, exploit details, and third-party analysis. Links are sourced from the NIST NVD database.
-
Third Party Advisory
-
Third Party Advisory
-
-
PatchKernel patch commithttps://git.kernel.org/stable/c/017198079551a2a5cf61eae966af3c4b145e1f3b
-
PatchKernel patch commithttps://git.kernel.org/stable/c/0f989f9d05492028afd2bded4b42023c57d8a76e
-
PatchKernel patch commithttps://git.kernel.org/stable/c/35b6fc51c666fc96355be5cd633ed0fe4ccf68b2
Frequently asked questions
-
What is CVE-2025-38687?
CVE-2025-38687 is a Medium severity Linux kernel vulnerability with a CVSS score of 4.7 out of 10 , classified as a Race Condition flaw (CWE-362) . It affects Linux kernel versions from 3.14 onward and has been patched in 5.4.297, 5.10.241, 5.15.190 and others. CVE-2025-38687 has not been confirmed as actively exploited and is not listed in the CISA KEV catalog.
-
What is the CVSS score for CVE-2025-38687?
CVE-2025-38687 has a CVSS score of 4.7 out of 10, rated Medium severity (CVSS 3.1). The vector string is
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H. -
Is there a patch available for CVE-2025-38687?
Yes — CVE-2025-38687 has been patched. Fixed versions include 5.4.297, 5.10.241, 5.15.190 and others. If you are running Linux kernel 3.14 or later up to the fix versions, apply the relevant patch for your kernel branch.
-
Is CVE-2025-38687 actively exploited?
No — CVE-2025-38687 has not been confirmed as actively exploited. It is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.
-
What is Race Condition (CWE-362)?
The product contains a code sequence that can run concurrently with other code, creating unexpected states. View CWE-362 on MITRE CWE →