Commit dbf540b
CKI Backport Bot
md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime
JIRA: https://issues.redhat.com/browse/RHEL-81540
CVE: CVE-2025-21712
commit 8d28d0d
Author: Yu Kuai <yukuai3@huawei.com>
Date: Fri Jan 24 17:20:55 2025 +0800
md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime
After commit ec6bb29 ("md/md-bitmap: add 'sync_size' into struct
md_bitmap_stats"), following panic is reported:
Oops: general protection fault, probably for non-canonical address
RIP: 0010:bitmap_get_stats+0x2b/0xa0
Call Trace:
<TASK>
md_seq_show+0x2d2/0x5b0
seq_read_iter+0x2b9/0x470
seq_read+0x12f/0x180
proc_reg_read+0x57/0xb0
vfs_read+0xf6/0x380
ksys_read+0x6c/0xf0
do_syscall_64+0x82/0x170
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Root cause is that bitmap_get_stats() can be called at anytime if mddev
is still there, even if bitmap is destroyed, or not fully initialized.
Deferenceing bitmap in this case can crash the kernel. Meanwhile, the
above commit start to deferencing bitmap->storage, make the problem
easier to trigger.
Fix the problem by protecting bitmap_get_stats() with bitmap_info.mutex.
Cc: stable@vger.kernel.org # v6.12+
Fixes: 32a7627 ("[PATCH] md: optimised resync using Bitmap based intent logging")
Reported-and-tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Closes: https://lore.kernel.org/linux-raid/ca3a91a2-50ae-4f68-b317-abd9889f3907@oracle.com/T/#m6e5086c95201135e4941fe38f9efa76daf9666c5
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20250124092055.4050195-1-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>1 parent 6f97af7 commit dbf540b
2 files changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2341 | 2341 | | |
2342 | 2342 | | |
2343 | 2343 | | |
2344 | | - | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
2345 | 2348 | | |
2346 | 2349 | | |
2347 | 2350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8376 | 8376 | | |
8377 | 8377 | | |
8378 | 8378 | | |
| 8379 | + | |
| 8380 | + | |
| 8381 | + | |
| 8382 | + | |
8379 | 8383 | | |
8380 | 8384 | | |
8381 | 8385 | | |
| |||
8451 | 8455 | | |
8452 | 8456 | | |
8453 | 8457 | | |
| 8458 | + | |
8454 | 8459 | | |
8455 | 8460 | | |
8456 | 8461 | | |
| |||
0 commit comments