CVE-2026-31703

Source
https://cve.org/CVERecord?id=CVE-2026-31703
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31703.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2026-31703
Downstream
Related
Published
2026-05-01T13:56:02.415Z
Modified
2026-07-01T04:02:26.547907148Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
writeback: Fix use after free in inode_switch_wbs_work_fn()
Details

In the Linux kernel, the following vulnerability has been resolved:

writeback: Fix use after free in inodeswitchwbsworkfn()

inodeswitchwbsworkfn() has a loop like:

wbget(newwb); while (1) { list = llistdelall(&newwb->switchwbs_ctxs); /* Nothing to do? */ if (!list) break; ... process the items ... }

Now adding of items to the list looks like:

wbqueueisw() if (llistadd(&isw->list, &wb->switchwbsctxs)) queuework(iswwq, &wb->switchwork);

Because inodeswitchwbsworkfn() loops when processing isw items, it can happen that wb->switchwork is pending while wb->switchwbs_ctxs is empty. This is a problem because in that case wb can get freed (no isw items -> no wb reference) while the work is still pending causing use-after-free issues.

We cannot just fix this by cancelling work when freeing wb because that could still trigger problematic 0 -> 1 transitions on wb refcount due to wbget() in inodeswitchwbsworkfn(). It could be all handled with more careful code but that seems unnecessarily complex so let's avoid that until it is proven that the looping actually brings practical benefit. Just remove the loop from inodeswitchwbsworkfn() instead. That way when wbqueueisw() queues work, we are guaranteed we have added the first item to wb->switchwbs_ctxs and nobody is going to remove it (and drop the wb reference it holds) until the queued work runs.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31703.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
fabfc1fcddc5d8185722d4fde5f0968c4760b71e
Fixed
156cc63691c1f20905510b1007896e090355e6c2
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
e1b849cfa6b61f1c866a908c9e8dd9b5aaab820b
Fixed
028103656b84273c73e9e271cf95c9f3421f4b8a
Fixed
9223e5f30403a9b506d6d0bff4f2e29a2d7d46af
Fixed
6689f01d6740cf358932b3e97ee968c6099800d9

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31703.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.18.0
Fixed
6.18.25
Type
ECOSYSTEM
Events
Introduced
6.19.0
Fixed
7.0.2

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31703.json"