CVE-2022-49834: nilfs2: fix use-after-free bug of ns_writer on remount
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: fix use-after-free bug of ns_writer on remount
If a nilfs2 filesystem is downgraded to read-only due to metadata
corruption on disk and is remounted read/write, or if emergency read-only
remount is performed, detaching a log writer and synchronizing the
filesystem can be done at the same time.
In these cases, use-after-free of the log writer (hereinafter
nilfs->ns_writer) can happen as shown in the scenario below:
Task1 Task2
-------------------------------- ------------------------------
nilfs_construct_segment
nilfs_segctor_sync
init_wait
init_waitqueue_entry
add_wait_queue
schedule
nilfs_remount (R/W remount case)
nilfs_attach_log_writer
nilfs_detach_log_writer
nilfs_segctor_destroy
kfree
finish_wait
_raw_spin_lock_irqsave
__raw_spin_lock_irqsave
do_raw_spin_lock
debug_spin_lock_before <-- use-after-free
While Task1 is sleeping, nilfs->ns_writer is freed by Task2. After Task1
waked up, Task1 accesses nilfs->ns_writer which is already freed. This
scenario diagram is based on the Shigeru Yoshida's post [1].
This patch fixes the issue by not detaching nilfs->ns_writer on remount so
that this UAF race doesn't happen. Along with this change, this patch
also inserts a few necessary read-only checks with superblock instance
where only the ns_writer pointer was used to check if the filesystem is
read-only.
Security readout for executives and security teams
Plain-English summary
CVE-2022-49834 is a Linux kernel NILFS2 filesystem bug. Under specific remount conditions after metadata corruption or emergency read-only remount, the kernel may access a freed log-writer object. The source confirms a fix, but does not provide CVSS, public exploitation, or business impact detail.
Executive priority
Treat this as a targeted Linux filesystem maintenance issue, not an internet-wide emergency. Patch through normal kernel update channels, with faster handling for storage systems using NILFS2 or reporting NILFS2 corruption/remount events.
Technical view
The flaw is a use-after-free race involving nilfs->ns_writer during NILFS2 segment synchronization and remount handling. One task can sleep in nilfs_segctor_sync while another remount path detaches and frees the log writer. The fix avoids detaching ns_writer on remount and adds read-only checks using the superblock instance.
Likely exposure
Exposure is most plausible on Linux systems that mount NILFS2 filesystems and run affected kernel versions or downstream builds missing the referenced stable fixes. Systems that do not use NILFS2 are unlikely to be exposed based on the provided sources.
Exploitation context
The bundle says KEV is false and provides no evidence of active exploitation. The described condition requires NILFS2, metadata corruption or emergency read-only behavior, and a remount race. No exploitability, privilege, or remote attack path is established in the sources.
Researcher notes
Evidence supports a kernel UAF race and stable-tree fixes, but not exploitability, CVSS severity, or real-world attacks. Analysis should stay scoped to NILFS2 remount behavior and downstream kernel backport status.
Mitigation direction
Check vendor kernel advisories for packages containing the referenced stable fixes.
Prioritize updates on systems that mount NILFS2 filesystems.
Avoid relying on emergency read-only remount as a long-term control.
If NILFS2 is unnecessary, disable or remove its use per platform policy.
Validation and detection
Inventory hosts for mounted NILFS2 filesystems or enabled NILFS2 support.
Compare deployed kernel builds against vendor-fixed versions or referenced commits.
Review logs for NILFS2 metadata corruption and emergency read-only remount events.
Confirm patched kernels no longer include the vulnerable remount behavior.
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-2022-49834 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.
0CVSS vectors
3Timeline events
0ADP providers
9Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
May 1, 2025, 14:09 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.