CVE-2024-27032: f2fs: fix to avoid potential panic during recovery
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to avoid potential panic during recovery
During recovery, if FAULT_BLOCK is on, it is possible that f2fs_reserve_new_block() will return -ENOSPC during recovery, then it may trigger panic.
Also, if fault injection rate is 1 and only FAULT_BLOCK fault type is on, it may encounter deadloop in loop of block reservation.
Let's change as below to fix these issues:
- remove bug_on() to avoid panic.
- limit the loop count of block reservation to avoid potential deadloop.
The Linux kernel CVE team has assigned CVE-2024-27032 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.1.77 with commit b1020a546779 and fixed in 6.1.83 with commit fe4de493572a Issue introduced in 6.6.16 with commit 2a7b12d4705b and fixed in 6.6.23 with commit 8844b2f8a3f0 Issue introduced in 6.7.4 with commit b29cc6e29b5e and fixed in 6.7.11 with commit d034810d02a5 Issue introduced in 6.8 with commit 956fa1ddc132 and fixed in 6.8.2 with commit f26091a98131 Issue introduced in 6.8 with commit 956fa1ddc132 and fixed in 6.9-rc1 with commit 21ec68234826 Issue introduced in 4.19.307 with commit bc1fb291f36d Issue introduced in 5.4.269 with commit 9fceaf8182d4 Issue introduced in 5.10.210 with commit 80c69f576ff3 Issue introduced in 5.15.149 with commit b4fb0807a1d6
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-27032
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/f2fs/f2fs.h fs/f2fs/recovery.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/fe4de493572a4263554903bf9c3afc5c196e15f0 https://git.kernel.org/stable/c/8844b2f8a3f0c428b74672f9726f9950b1a7764c https://git.kernel.org/stable/c/d034810d02a5af8eb74debe29877dcaf5f00fdd1 https://git.kernel.org/stable/c/f26091a981318b5b7451d61f99bc073a6af8db67 https://git.kernel.org/stable/c/21ec68234826b1b54ab980a8df6e33c74cfbee58