CVE-2025-39866: fs: writeback: fix use-after-free in __mark_inode_dirty()
In the Linux kernel, the following vulnerability has been resolved:
fs: writeback: fix use-after-free in __mark_inode_dirty()
An use-after-free issue occurred when __mark_inode_dirty() get the
bdi_writeback that was in the progress of switching.
CPU: 1 PID: 562 Comm: systemd-random- Not tainted 6.6.56-gb4403bd46a8e #1
......
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __mark_inode_dirty+0x124/0x418
lr : __mark_inode_dirty+0x118/0x418
sp : ffffffc08c9dbbc0
........
Call trace:
__mark_inode_dirty+0x124/0x418
generic_update_time+0x4c/0x60
file_modified+0xcc/0xd0
ext4_buffered_write_iter+0x58/0x124
ext4_file_write_iter+0x54/0x704
vfs_write+0x1c0/0x308
ksys_write+0x74/0x10c
__arm64_sys_write+0x1c/0x28
invoke_syscall+0x48/0x114
el0_svc_common.constprop.0+0xc0/0xe0
do_el0_svc+0x1c/0x28
el0_svc+0x40/0xe4
el0t_64_sync_handler+0x120/0x12c
el0t_64_sync+0x194/0x198
Root cause is:
systemd-random-seed kworker
----------------------------------------------------------------------
___mark_inode_dirty inode_switch_wbs_work_fn
spin_lock(&inode->i_lock);
inode_attach_wb
locked_inode_to_wb_and_lock_list
get inode->i_wb
spin_unlock(&inode->i_lock);
spin_lock(&wb->list_lock)
spin_lock(&inode->i_lock)
inode_io_list_move_locked
spin_unlock(&wb->list_lock)
spin_unlock(&inode->i_lock)
spin_lock(&old_wb->list_lock)
inode_do_switch_wbs
spin_lock(&inode->i_lock)
inode->i_wb = new_wb
spin_unlock(&inode->i_lock)
spin_unlock(&old_wb->list_lock)
wb_put_many(old_wb, nr_switched)
cgwb_release
old wb released
wb_wakeup_delayed() accesses wb,
then trigger the use-after-free
issue
Fix this race condition by holding inode spinlock until
wb_wakeup_delayed() finished.
Security readout for executives and security teams
Plain-English summary
A Linux kernel race can access a writeback object after it has been freed. The observed failure occurred during a normal file write and can crash the kernel. The supplied CVSS score is 7.8 because a low-privileged local actor may affect confidentiality, integrity, and availability, although the sources do not demonstrate successful exploitation.
Executive priority
Treat this as an expedited Linux patching item, especially for shared or multi-tenant systems. The potential impact is high, but urgency is moderated by the local-access requirement and lack of cited active exploitation. Use vendor package guidance rather than interpreting upstream version numbers alone.
Technical view
__mark_inode_dirty() can retain an inode’s old bdi_writeback while inode_switch_wbs_work_fn changes and releases it. A subsequent wb_wakeup_delayed() call accesses the freed object. The kernel fix keeps the inode spinlock held until the wakeup finishes, closing the race. The supplied trace involved ext4 writes on arm64 Linux 6.6.56.
Likely exposure
Exposure is limited to affected Linux kernels and requires local, low-privileged access according to the CVSS vector. Shared Linux hosts and systems running untrusted local workloads deserve particular attention. The bundled version data is insufficiently structured to determine every vulnerable distribution package; vendor backports may also change exposure.
Exploitation context
The source bundle marks this CVE as absent from CISA KEV and provides no evidence of active exploitation, public exploit code, or reliable privilege escalation. It documents a reproducible kernel use-after-free and crash trace. Internet reachability alone does not create a remote attack path because the supplied vector is AV:L.
Researcher notes
The race crosses inode writeback reassignment: the old writeback structure can be released after inode->i_wb changes but before wb_wakeup_delayed() finishes using it. The sources provide multiple stable-branch fixes. They provide no CWE classification, exploitability analysis, or proof that controlled code execution is achievable rather than a crash.
Mitigation direction
Install a vendor-supported kernel update containing the applicable stable fix or backport.
Reboot affected systems into the updated kernel following normal change-control procedures.
Prioritize shared hosts and systems permitting untrusted or low-privileged local workloads.
Until updated, reduce unnecessary local access and follow distribution-specific vendor guidance.
Validation and detection
Inventory installed and running kernel versions across Linux systems.
Check each distribution or appliance advisory for its exact affected and fixed package versions.
Confirm the running kernel contains the applicable stable fix or vendor backport.
Review kernel logs for faults involving __mark_inode_dirty or related use-after-free reports.
Verify systems booted the updated kernel after remediation; installation alone is insufficient.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2025-39866 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
2ADP providers
12Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.