CVE-2026-31703
Received Received - Intake
Use After Free in Linux Kernel writeback

Publication date: 2026-05-01

Last updated on: 2026-05-06

Assigner: kernel.org

Description
In the Linux kernel, the following vulnerability has been resolved: writeback: Fix use after free in inode_switch_wbs_work_fn() inode_switch_wbs_work_fn() has a loop like: wb_get(new_wb); while (1) { list = llist_del_all(&new_wb->switch_wbs_ctxs); /* Nothing to do? */ if (!list) break; ... process the items ... } Now adding of items to the list looks like: wb_queue_isw() if (llist_add(&isw->list, &wb->switch_wbs_ctxs)) queue_work(isw_wq, &wb->switch_work); Because inode_switch_wbs_work_fn() loops when processing isw items, it can happen that wb->switch_work is pending while wb->switch_wbs_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 wb_get() in inode_switch_wbs_work_fn(). 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 inode_switch_wbs_work_fn() instead. That way when wb_queue_isw() queues work, we are guaranteed we have added the first item to wb->switch_wbs_ctxs and nobody is going to remove it (and drop the wb reference it holds) until the queued work runs.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-05-01
Last Modified
2026-05-06
Generated
2026-05-07
AI Q&A
2026-05-01
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 4 associated CPEs
Vendor Product Version / Range
linux linux_kernel 7.1
linux linux_kernel 7.1
linux linux_kernel From 6.19 (inc) to 7.0.2 (exc)
linux linux_kernel From 6.18 (inc) to 6.18.25 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-416 The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Attack-Flow Graph
AI Powered Q&A
What immediate steps should I take to mitigate this vulnerability?

The vulnerability has been resolved by removing the loop in the inode_switch_wbs_work_fn() function in the Linux kernel to prevent use-after-free issues.

To mitigate this vulnerability, you should update your Linux kernel to a version that includes this fix.


Can you explain this vulnerability to me?

This vulnerability is a use-after-free issue in the Linux kernel's writeback subsystem, specifically in the function inode_switch_wbs_work_fn().

The problem arises because inode_switch_wbs_work_fn() processes a list of work items in a loop, and during this process, the associated writeback structure (wb) can be freed while work is still pending. This happens when the work queue is empty but the work is still scheduled, leading to a situation where wb is freed but the work function tries to access it, causing a use-after-free error.

The fix involved removing the loop in inode_switch_wbs_work_fn() to ensure that when work is queued, the first item is guaranteed to be present and the wb reference is held until the work runs, preventing premature freeing and thus avoiding the use-after-free condition.


How can this vulnerability impact me? :

This use-after-free vulnerability can lead to undefined behavior in the Linux kernel, including potential system crashes, data corruption, or privilege escalation if exploited.

Because it involves kernel memory management, an attacker who can trigger this vulnerability might execute arbitrary code with kernel privileges or cause denial of service by crashing the system.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart