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.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31703.json"
}