{
  "affected": [
    {
      "ranges": [
        {
          "events": [
            {
              "introduced": "49b420a13ff95b449947181190b08367348e3e1b"
            },
            {
              "fixed": "dc23806a7c47ec5f1293aba407fb69519f976ee0"
            }
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "type": "GIT"
        }
      ]
    }
  ],
  "database_specific": {
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31688.json"
  },
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\ndriver core: enforce device_lock for driver_match_device()\n\nCurrently, driver_match_device() is called from three sites. One site\n(__device_attach_driver) holds device_lock(dev), but the other two\n(bind_store and __driver_attach) do not. This inconsistency means that\nbus match() callbacks are not guaranteed to be called with the lock\nheld.\n\nFix this by introducing driver_match_device_locked(), which guarantees\nholding the device lock using a scoped guard. Replace the unlocked calls\nin bind_store() and __driver_attach() with this new helper. Also add a\nlock assertion to driver_match_device() to enforce this guarantee.\n\nThis consistency also fixes a known race condition. The driver_override\nimplementation relies on the device_lock, so the missing lock led to the\nuse-after-free (UAF) reported in Bugzilla for buses using this field.\n\nStress testing the two newly locked paths for 24 hours with\nCONFIG_PROVE_LOCKING and CONFIG_LOCKDEP enabled showed no UAF recurrence\nand no lockdep warnings.",
  "id": "CVE-2026-31688",
  "modified": "2026-07-08T05:39:02.973453736Z",
  "published": "2026-04-27T17:32:37.892Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/dc23806a7c47ec5f1293aba407fb69519f976ee0"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31688.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31688"
    },
    {
      "type": "PACKAGE",
      "url": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
    }
  ],
  "schema_version": "1.7.5",
  "summary": "driver core: enforce device_lock for driver_match_device()"
}