CVE-2021-47460: ocfs2: fix data corruption after conversion from inline format
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: fix data corruption after conversion from inline format
Commit 6dbf7bb55598 ("fs: Don't invalidate page buffers in
block_write_full_page()") uncovered a latent bug in ocfs2 conversion
from inline inode format to a normal inode format.
The code in ocfs2_convert_inline_data_to_extents() attempts to zero out
the whole cluster allocated for file data by grabbing, zeroing, and
dirtying all pages covering this cluster. However these pages are
beyond i_size, thus writeback code generally ignores these dirty pages
and no blocks were ever actually zeroed on the disk.
This oversight was fixed by commit 693c241a5f6a ("ocfs2: No need to zero
pages past i_size.") for standard ocfs2 write path, inline conversion
path was apparently forgotten; the commit log also has a reasoning why
the zeroing actually is not needed.
After commit 6dbf7bb55598, things became worse as writeback code stopped
invalidating buffers on pages beyond i_size and thus these pages end up
with clean PageDirty bit but with buffers attached to these pages being
still dirty. So when a file is converted from inline format, then
writeback triggers, and then the file is grown so that these pages
become valid, the invalid dirtiness state is preserved,
mark_buffer_dirty() does nothing on these pages (buffers are already
dirty) but page is never written back because it is clean. So data
written to these pages is lost once pages are reclaimed.
Simple reproducer for the problem is:
xfs_io -f -c "pwrite 0 2000" -c "pwrite 2000 2000" -c "fsync" \
-c "pwrite 4000 2000" ocfs2_file
After unmounting and mounting the fs again, you can observe that end of
'ocfs2_file' has lost its contents.
Fix the problem by not doing the pointless zeroing during conversion
from inline format similarly as in the standard write path.
[akpm@linux-foundation.org: fix whitespace, per Joseph]
Security readout for executives and security teams
Plain-English summary
CVE-2021-47460 is a Linux kernel ocfs2 filesystem bug that can cause file data to be lost after an inline-file conversion and later file growth. The business impact is data integrity, not remote code execution. Systems are mainly exposed if they run affected Linux kernels and actively use ocfs2.
Executive priority
Treat this as a targeted data-integrity issue. It should be prioritized where ocfs2 supports business-critical storage or clustered workloads. It is lower urgency for environments without ocfs2 usage, and the source bundle provides no evidence of active exploitation.
Technical view
The ocfs2 inline-to-extent conversion path dirtied pages beyond i_size while zeroing a cluster. Writeback could ignore those clean pages with dirty buffers, preserving invalid state. Later writes after file growth could be lost when pages were reclaimed. The fix removes the unnecessary zeroing during inline conversion.
Likely exposure
Exposure appears limited to Linux systems using ocfs2 on affected kernel versions or commits listed by the CVE source. Organizations not using ocfs2 are unlikely to be affected by this specific bug, although kernel package inventories should confirm filesystem usage and kernel lineage.
Exploitation context
The source bundle does not show KEV listing or active exploitation. The described impact is reproducible data loss under specific filesystem write and growth conditions, but the provided sources do not establish remote attackability, privilege escalation, or public exploitation in the wild.
Researcher notes
The bug is in fs/ocfs2 inline data conversion behavior exposed by an earlier writeback change. The CVE has no CVSS, CWE, or KEV evidence in the bundle. Validate exposure by kernel branch, downstream backports, and actual ocfs2 usage rather than Linux presence alone.
Mitigation direction
Identify systems running Linux kernels with ocfs2 enabled or mounted.
Prioritize patching systems that store important data on ocfs2.
Update to vendor kernels containing the referenced stable fixes.
If no vendor advisory is available, check Linux distribution guidance.
Back up ocfs2 data before maintenance on exposed systems.
Validation and detection
Inventory mounted filesystems and kernel versions on Linux hosts.
Confirm whether ocfs2 is loaded, configured, or in production use.
Map kernel packages to vendor fixes or referenced stable commits.
Review storage monitoring for unexplained ocfs2 file corruption reports.
Run regression tests for ocfs2 workloads after patching.
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-2021-47460 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.