CVE-2021-47460
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
22/05/2024
Last modified:
24/09/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ocfs2: fix data corruption after conversion from inline format<br />
<br />
Commit 6dbf7bb55598 ("fs: Don&#39;t invalidate page buffers in<br />
block_write_full_page()") uncovered a latent bug in ocfs2 conversion<br />
from inline inode format to a normal inode format.<br />
<br />
The code in ocfs2_convert_inline_data_to_extents() attempts to zero out<br />
the whole cluster allocated for file data by grabbing, zeroing, and<br />
dirtying all pages covering this cluster. However these pages are<br />
beyond i_size, thus writeback code generally ignores these dirty pages<br />
and no blocks were ever actually zeroed on the disk.<br />
<br />
This oversight was fixed by commit 693c241a5f6a ("ocfs2: No need to zero<br />
pages past i_size.") for standard ocfs2 write path, inline conversion<br />
path was apparently forgotten; the commit log also has a reasoning why<br />
the zeroing actually is not needed.<br />
<br />
After commit 6dbf7bb55598, things became worse as writeback code stopped<br />
invalidating buffers on pages beyond i_size and thus these pages end up<br />
with clean PageDirty bit but with buffers attached to these pages being<br />
still dirty. So when a file is converted from inline format, then<br />
writeback triggers, and then the file is grown so that these pages<br />
become valid, the invalid dirtiness state is preserved,<br />
mark_buffer_dirty() does nothing on these pages (buffers are already<br />
dirty) but page is never written back because it is clean. So data<br />
written to these pages is lost once pages are reclaimed.<br />
<br />
Simple reproducer for the problem is:<br />
<br />
xfs_io -f -c "pwrite 0 2000" -c "pwrite 2000 2000" -c "fsync" \<br />
-c "pwrite 4000 2000" ocfs2_file<br />
<br />
After unmounting and mounting the fs again, you can observe that end of<br />
&#39;ocfs2_file&#39; has lost its contents.<br />
<br />
Fix the problem by not doing the pointless zeroing during conversion<br />
from inline format similarly as in the standard write path.<br />
<br />
[akpm@linux-foundation.org: fix whitespace, per Joseph]
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.9.242 (including) | 4.9.288 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.14.204 (including) | 4.14.253 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.19.155 (including) | 4.19.214 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.4.75 (including) | 5.4.156 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.9.5 (including) | 5.10.76 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.14.15 (excluding) |
| cpe:2.3:o:linux:linux_kernel:5.15:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.15:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.15:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.15:rc4:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.15:rc5:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.15:rc6:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa
- https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f
- https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e
- https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a
- https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632
- https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360
- https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08
- https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa
- https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f
- https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e
- https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a
- https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632
- https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360
- https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08



