{
  "id": "CVE-2025-38687",
  "url": "https://poc.griffinguard.io/cve/CVE-2025-38687",
  "published_at": "2025-09-04T15:32:41.702Z",
  "title": "comedi: fix race between polling and detaching",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 7.3,
    "source": "cna",
    "vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H"
  },
  "kev": {
    "in_kev": false,
    "added_at": null,
    "days_after_publication": null
  },
  "first_poc": null,
  "poc_repo_count": 0,
  "exploit_count": 0,
  "suspicious_repo_count": 0,
  "edge_device": null,
  "description": "In the Linux kernel, the following vulnerability has been resolved:\n\ncomedi: fix race between polling and detaching\n\nsyzbot reports a use-after-free in comedi in the below link, which is\ndue to comedi gladly removing the allocated async area even though poll\nrequests are still active on the wait_queue_head inside of it. This can\ncause a use-after-free when the poll entries are later triggered or\nremoved, as the memory for the wait_queue_head has been freed.  We need\nto check there are no tasks queued on any of the subdevices' wait queues\nbefore allowing the device to be detached by the `COMEDI_DEVCONFIG`\nioctl.\n\nTasks will read-lock `dev-\u003eattach_lock` before adding themselves to the\nsubdevice wait queue, so fix the problem in the `COMEDI_DEVCONFIG` ioctl\nhandler by write-locking `dev-\u003eattach_lock` before checking that all of\nthe subdevices are safe to be deleted.  This includes testing for any\nsleepers on the subdevices' wait queues.  It remains locked until the\ndevice has been detached.  This requires the `comedi_device_detach()`\nfunction to be refactored slightly, moving the bulk of it into new\nfunction `comedi_device_detach_locked()`.\n\nNote that the refactor of `comedi_device_detach()` results in\n`comedi_device_cancel_all()` now being called while `dev-\u003eattach_lock`\nis write-locked, which wasn't the case previously, but that does not\nmatter.\n\nThanks to Jens Axboe for diagnosing the problem and co-developing this\npatch.",
  "cwe": "CWE-362",
  "cpes": [
    "cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*"
  ],
  "cvss_by_source": {
    "cna": 7.3,
    "nvd": 4.7
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c fe67122ba781df44a1a9716eb1dfd751321ab512",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c cd4286123d6948ff638ea9cd5818ae4796d5d252",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c d85fac8729c9acfd72368faff1d576ec585e5c8f",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c 0f989f9d05492028afd2bded4b42023c57d8a76e",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c 017198079551a2a5cf61eae966af3c4b145e1f3b",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c 71ca60d2e631cf9c63bcbc7017961c61ff04e419",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c 5724e82df4f9a4be62908362c97d522d25de75dd",
          "\u003e= 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1, \u003c 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2"
        ],
        "fixed_in": [
          "fe67122ba781df44a1a9716eb1dfd751321ab512",
          "cd4286123d6948ff638ea9cd5818ae4796d5d252",
          "d85fac8729c9acfd72368faff1d576ec585e5c8f",
          "0f989f9d05492028afd2bded4b42023c57d8a76e",
          "5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4",
          "017198079551a2a5cf61eae966af3c4b145e1f3b",
          "71ca60d2e631cf9c63bcbc7017961c61ff04e419",
          "5724e82df4f9a4be62908362c97d522d25de75dd",
          "35b6fc51c666fc96355be5cd633ed0fe4ccf68b2"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "3.14"
        ],
        "fixed_in": [
          "0",
          "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"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to fe67122ba781df44a1a9716eb1dfd751321ab512 or cd4286123d6948ff638ea9cd5818ae4796d5d252 or d85fac8729c9acfd72368faff1d576ec585e5c8f or 0f989f9d05492028afd2bded4b42023c57d8a76e or 5c4a2ffcbd052c69bbf4680677d4c4eaa5a252d4 or 017198079551a2a5cf61eae966af3c4b145e1f3b or 71ca60d2e631cf9c63bcbc7017961c61ff04e419 or 5724e82df4f9a4be62908362c97d522d25de75dd or 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2 or later.",
      "Upgrade Linux to 0 or 5.4.297 or 5.10.241 or 5.15.190 or 6.1.149 or 6.6.103 or 6.12.43 or 6.15.11 or 6.16.2 or 6.17 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
