CVE-2024-35844: f2fs: compress: fix reserve_cblocks counting error when out of space
In the Linux kernel, the following vulnerability has been resolved:
f2fs: compress: fix reservecblocks counting error when out of space
When a file only needs one directnode, performing the following operations will cause the file to be unrepairable:
unisoc # ./f2fsio compress test.apk unisoc #df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.2M 100% /data
unisoc # ./f2fsio releasecblocks test.apk 924 unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 4.8M 100% /data
unisoc # dd if=/dev/random of=file4 bs=1M count=3 3145728 bytes (3.0 M) copied, 0.025 s, 120 M/s unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.8M 100% /data
unisoc # ./f2fsio reservecblocks test.apk F2FSIOCRESERVECOMPRESSBLOCKS failed: No space left on device
adb reboot unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 11M 100% /data unisoc # ./f2fsio reservecblocks test.apk 0
This is because the file has only one directnode. After returning to -ENOSPC, reservedblocks += ret will not be executed. As a result, the reservedblocks at this time is still 0, which is not the real number of reserved blocks. Therefore, fsck cannot be set to repair the file.
After this patch, the fsck flag will be set to fix this problem.
unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.8M 100% /data unisoc # ./f2fsio reservecblocks test.apk F2FSIOCRESERVECOMPRESSBLOCKS failed: No space left on device
adb reboot then fsck will be executed unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 11M 100% /data unisoc # ./f2fsio reservecblocks test.apk 924
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-35844?
CVE-2024-35844 is considered a moderate severity vulnerability affecting the Linux kernel's f2fs compression functionality.
How do I fix CVE-2024-35844?
To fix CVE-2024-35844, update to the patched versions of the Linux kernel: 6.1.123-1, 6.1.119-1, 6.12.11-1, or 6.12.12-1.
Which versions of the Linux kernel are affected by CVE-2024-35844?
CVE-2024-35844 affects Linux kernel versions up to and including 5.10.226-1.
What is the impact of CVE-2024-35844 on f2fs file system operations?
The impact of CVE-2024-35844 is that performing certain operations may cause files to become unrepairable when using the f2fs file system.
Are there any specific conditions to trigger CVE-2024-35844?
Yes, the vulnerability can be triggered when a file requires only one direct_node and specific compression operations are performed.