Skip to contentSkip to conversation

CVE-2025-22124: md/md-bitmap: fix wrong bitmap_limit for clustermd when write sb

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Apr 16, 2025

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

md/md-bitmap: fix wrong bitmap_limit for clustermd when write sb

In clustermd, separate write-intent-bitmaps are used for each cluster node:

0 4k 8k 12k
-------------------------------------------------------------------

| idle                | md super            | bm super [0] + bits |
| bm bits[0, contd]   | bm super[1] + bits  | bm bits[1, contd]   |
| bm super[2] + bits  | bm bits [2, contd]  | bm super[3] + bits  |
| bm bits [3, contd]  |                     |                     |

So in node 1, pg_index in __write_sb_page() could equal to bitmap->storage.file_pages. Then bitmap_limit will be calculated to
0. md_super_write() will be called with 0 size.
That means the first 4k sb area of node 1 will never be updated through filemap_write_page().
This bug causes hang of mdadm/clustermd_tests/01r1_Grow_resize.

Here use (pg_index % bitmap->storage.file_pages) to make calculation of bitmap_limit correct.

The Linux kernel CVE team has assigned CVE-2025-22124 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.11 with commit ab99a87542f194f28e2364a42afbf9fb48b1c724 and fixed in 6.14.2 with commit bc3a9788961631359527763d7e1fcf26554c7cb1
	Issue introduced in 6.11 with commit ab99a87542f194f28e2364a42afbf9fb48b1c724 and fixed in 6.15-rc1 with commit 6130825f34d41718c98a9b1504a79a23e379701e
	Issue introduced in 6.6.44 with commit 655cc01889fa9b65441922565cddee64af49e6d6
	Issue introduced in 6.10.3 with commit 5600d6013c634c2b6b6c6c55c8ecb50c3a6211f2

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-2025-22124

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:
drivers/md/md-bitmap.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/bc3a9788961631359527763d7e1fcf26554c7cb1
	https://git.kernel.org/stable/c/6130825f34d41718c98a9b1504a79a23e379701e