{
  "id": "CVE-2026-31703",
  "url": "https://poc.griffinguard.io/cve/CVE-2026-31703",
  "published_at": "2026-05-01T13:56:02.415Z",
  "title": "writeback: Fix use after free in inode_switch_wbs_work_fn()",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 7.8,
    "source": "cna",
    "vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/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\nwriteback: Fix use after free in inode_switch_wbs_work_fn()\n\ninode_switch_wbs_work_fn() has a loop like:\n\n  wb_get(new_wb);\n  while (1) {\n    list = llist_del_all(\u0026new_wb-\u003eswitch_wbs_ctxs);\n    /* Nothing to do? */\n    if (!list)\n      break;\n    ... process the items ...\n  }\n\nNow adding of items to the list looks like:\n\nwb_queue_isw()\n  if (llist_add(\u0026isw-\u003elist, \u0026wb-\u003eswitch_wbs_ctxs))\n    queue_work(isw_wq, \u0026wb-\u003eswitch_work);\n\nBecause inode_switch_wbs_work_fn() loops when processing isw items, it\ncan happen that wb-\u003eswitch_work is pending while wb-\u003eswitch_wbs_ctxs is\nempty. This is a problem because in that case wb can get freed (no isw\nitems -\u003e no wb reference) while the work is still pending causing\nuse-after-free issues.\n\nWe cannot just fix this by cancelling work when freeing wb because that\ncould still trigger problematic 0 -\u003e 1 transitions on wb refcount due to\nwb_get() in inode_switch_wbs_work_fn(). It could be all handled with\nmore careful code but that seems unnecessarily complex so let's avoid\nthat until it is proven that the looping actually brings practical\nbenefit. Just remove the loop from inode_switch_wbs_work_fn() instead.\nThat way when wb_queue_isw() queues work, we are guaranteed we have\nadded the first item to wb-\u003eswitch_wbs_ctxs and nobody is going to\nremove it (and drop the wb reference it holds) until the queued work\nruns.",
  "cwe": "CWE-416",
  "cpes": [
    "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:7.1:rc1:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:7.1:rc2:*:*:*:*:*:*"
  ],
  "cvss_by_source": {
    "cna": 7.8
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= d072b38a64ddbc2d58c2e525a24af24ecbfebcb7, \u003c 382cf81cae89e58d22b4bdc38891cd4d0b9ba921",
          "\u003e= ac7b2c21f2269d815ad0cdf0f8258d55185b805c, \u003c 19ec404b079be057b387643ba0c69bbcc5867c35",
          "\u003e= fabfc1fcddc5d8185722d4fde5f0968c4760b71e, \u003c 156cc63691c1f20905510b1007896e090355e6c2",
          "\u003e= e1b849cfa6b61f1c866a908c9e8dd9b5aaab820b, \u003c 028103656b84273c73e9e271cf95c9f3421f4b8a",
          "\u003e= e1b849cfa6b61f1c866a908c9e8dd9b5aaab820b, \u003c 9223e5f30403a9b506d6d0bff4f2e29a2d7d46af",
          "\u003e= e1b849cfa6b61f1c866a908c9e8dd9b5aaab820b, \u003c 6689f01d6740cf358932b3e97ee968c6099800d9"
        ],
        "fixed_in": [
          "382cf81cae89e58d22b4bdc38891cd4d0b9ba921",
          "19ec404b079be057b387643ba0c69bbcc5867c35",
          "156cc63691c1f20905510b1007896e090355e6c2",
          "028103656b84273c73e9e271cf95c9f3421f4b8a",
          "9223e5f30403a9b506d6d0bff4f2e29a2d7d46af",
          "6689f01d6740cf358932b3e97ee968c6099800d9"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "6.18"
        ],
        "fixed_in": [
          "0",
          "6.18.25",
          "7.0.2",
          "7.1"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to 382cf81cae89e58d22b4bdc38891cd4d0b9ba921 or 19ec404b079be057b387643ba0c69bbcc5867c35 or 156cc63691c1f20905510b1007896e090355e6c2 or 028103656b84273c73e9e271cf95c9f3421f4b8a or 9223e5f30403a9b506d6d0bff4f2e29a2d7d46af or 6689f01d6740cf358932b3e97ee968c6099800d9 or later.",
      "Upgrade Linux to 0 or 6.18.25 or 7.0.2 or 7.1 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
