dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/super1-only-set-clustered4-flag2-when-bitmap-is-presen.patch

2c1b57
From 6438c249c4fed92cf6e5fb492d19f4c4f516ff6f Mon Sep 17 00:00:00 2001
2c1b57
From: NeilBrown <neilb@suse.com>
2c1b57
Date: Fri, 4 Aug 2017 15:30:02 +1000
2c1b57
Subject: [RHEL7.5 PATCH 166/169] super1: only set clustered flag when
2c1b57
 bitmap is present
2c1b57
2c1b57
If no bitmap is present, then the test
2c1b57
2c1b57
	if (__le32_to_cpu(bsb->nodes) > 1)
2c1b57
2c1b57
accesses uninitialised memory.  So move that test inside
2c1b57
a test for a bitmap being present.
2c1b57
2c1b57
Signed-off-by: NeilBrown <neilb@suse.com>
2c1b57
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2c1b57
---
2c1b57
 super1.c | 4 ++--
2c1b57
 1 file changed, 2 insertions(+), 2 deletions(-)
2c1b57
2c1b57
diff --git a/super1.c b/super1.c
2c1b57
index b15a1c7..f6a1045 100644
2c1b57
--- a/super1.c
2c1b57
+++ b/super1.c
2c1b57
@@ -977,14 +977,14 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
2c1b57
 	info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512;
2c1b57
 	info->array.state =
2c1b57
 		(__le64_to_cpu(sb->resync_offset) == MaxSector)	? 1 : 0;
2c1b57
-	if (__le32_to_cpu(bsb->nodes) > 1)
2c1b57
-		info->array.state |= (1 << MD_SB_CLUSTERED);
2c1b57
 
2c1b57
 	super_offset = __le64_to_cpu(sb->super_offset);
2c1b57
 	info->data_offset = __le64_to_cpu(sb->data_offset);
2c1b57
 	info->component_size = __le64_to_cpu(sb->size);
2c1b57
 	if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET)) {
2c1b57
 		info->bitmap_offset = (int32_t)__le32_to_cpu(sb->bitmap_offset);
2c1b57
+		if (__le32_to_cpu(bsb->nodes) > 1)
2c1b57
+			info->array.state |= (1 << MD_SB_CLUSTERED);
2c1b57
 	} else if (sb->feature_map & __le32_to_cpu(MD_FEATURE_PPL)) {
2c1b57
 		info->ppl_offset = __le16_to_cpu(sb->ppl.offset);
2c1b57
 		info->ppl_size = __le16_to_cpu(sb->ppl.size);
2c1b57
-- 
2c1b57
2.7.4
2c1b57