dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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