CVE-2024-42295: nilfs2: handle inconsistent state in nilfs_btnode_create_block()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: handle inconsistent state in nilfs_btnode_create_block()
Syzbot reported that a buffer state inconsistency was detected in nilfs_btnode_create_block(), triggering a kernel bug.
It is not appropriate to treat this inconsistency as a bug; it can occur if the argument block address (the buffer index of the newly created block) is a virtual block number and has been reallocated due to corruption of the bitmap used to manage its allocation state.
So, modify nilfs_btnode_create_block() and its callers to treat it as a possible filesystem error, rather than triggering a kernel bug.
The Linux kernel CVE team has assigned CVE-2024-42295 to this issue.
Affected and fixed versions
===========================
Issue introduced in 2.6.30 with commit a60be987d45d and fixed in 6.1.103 with commit 012be828a118 Issue introduced in 2.6.30 with commit a60be987d45d and fixed in 6.6.44 with commit be56dfc9be06 Issue introduced in 2.6.30 with commit a60be987d45d and fixed in 6.10.3 with commit 366c3f688dd0 Issue introduced in 2.6.30 with commit a60be987d45d and fixed in 6.11-rc1 with commit 4811f7af6090
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-42295
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/nilfs2/btnode.c
fs/nilfs2/btree.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/012be828a118bf496e666ef1fc47fc0e7358ada2 https://git.kernel.org/stable/c/be56dfc9be0604291267c07b0e27a69a6bda4899 https://git.kernel.org/stable/c/366c3f688dd0288cbe38af1d3a886b5c62372e4a https://git.kernel.org/stable/c/4811f7af6090e8f5a398fbdd766f903ef6c0d787