CVE-2024-26601: ext4: regenerate buddy after block freeing failed if under fc replay
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ext4: regenerate buddy after block freeing failed if under fc replay
This mostly reverts commit 6bd97bf273bd ("ext4: remove redundant mb_regenerate_buddy()") and reintroduces mb_regenerate_buddy(). Based on code in mb_free_blocks(), fast commit replay can end up marking as free blocks that are already marked as such. This causes corruption of the buddy bitmap so we need to regenerate it in that case.
The Linux kernel CVE team has assigned CVE-2024-26601 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.11 with commit 6bd97bf273bd and fixed in 6.1.78 with commit 78327acd4cdc Issue introduced in 5.11 with commit 6bd97bf273bd and fixed in 6.6.17 with commit ea42d6cffb0d Issue introduced in 5.11 with commit 6bd97bf273bd and fixed in 6.7.5 with commit 6b0d48647935 Issue introduced in 5.11 with commit 6bd97bf273bd and fixed in 6.8-rc3 with commit c9b528c35795
Please see https://www.kernel.org or 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-26601
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/ext4/mballoc.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/78327acd4cdc4a1601af718b781eece577b6b7d4 https://git.kernel.org/stable/c/ea42d6cffb0dd27a417f410b9d0011e9859328cb https://git.kernel.org/stable/c/6b0d48647935e4b8c7b75d1eccb9043fcd4ee581 https://git.kernel.org/stable/c/c9b528c35795b711331ed36dc3dbee90d5812d4e