Skip to content

Commit e9d8c87

Browse files
committed
Merge tag 'md-6.14-20250124' of https://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux into block-6.14
Pull MD fix from Song: "Fix a md-cluster regression introduced in the 6.12 release." * tag 'md-6.14-20250124' of https://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux: md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime
2 parents a9ae6fe + 8d28d0d commit e9d8c87

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

drivers/md/md-bitmap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,10 @@ static int bitmap_get_stats(void *data, struct md_bitmap_stats *stats)
23552355

23562356
if (!bitmap)
23572357
return -ENOENT;
2358-
2358+
if (bitmap->mddev->bitmap_info.external)
2359+
return -ENOENT;
2360+
if (!bitmap->storage.sb_page) /* no superblock */
2361+
return -EINVAL;
23592362
sb = kmap_local_page(bitmap->storage.sb_page);
23602363
stats->sync_size = le64_to_cpu(sb->sync_size);
23612364
kunmap_local(sb);

drivers/md/md.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8376,6 +8376,10 @@ static int md_seq_show(struct seq_file *seq, void *v)
83768376
return 0;
83778377

83788378
spin_unlock(&all_mddevs_lock);
8379+
8380+
/* prevent bitmap to be freed after checking */
8381+
mutex_lock(&mddev->bitmap_info.mutex);
8382+
83798383
spin_lock(&mddev->lock);
83808384
if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) {
83818385
seq_printf(seq, "%s : ", mdname(mddev));
@@ -8451,6 +8455,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
84518455
seq_printf(seq, "\n");
84528456
}
84538457
spin_unlock(&mddev->lock);
8458+
mutex_unlock(&mddev->bitmap_info.mutex);
84548459
spin_lock(&all_mddevs_lock);
84558460

84568461
if (mddev == list_last_entry(&all_mddevs, struct mddev, all_mddevs))

0 commit comments

Comments
 (0)