dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-3.4-super1-Clear-memory-allocated-for-superblock-bitmap-.patch

7bdf8f
From 1dcee1c9cbcf9592275914706b76b1931490092c Mon Sep 17 00:00:00 2001
7bdf8f
From: Jes Sorensen <Jes.Sorensen@redhat.com>
7bdf8f
Date: Wed, 6 Apr 2016 16:13:59 -0400
7bdf8f
Subject: [PATCH] super1: Clear memory allocated for superblock + bitmap before
7bdf8f
 use
7bdf8f
7bdf8f
load_super1() did not clear memory allocated for the superblock +
7bdf8f
bitmap. This causes issues if the superblock does not contain a bitmap
7bdf8f
as later checks of bitmap features would rely on the bits being
7bdf8f
cleared.
7bdf8f
7bdf8f
This bug has been around for a long time, but was only exposed in
7bdf8f
mdadm-3.4 with the introduction of the clustering code.
7bdf8f
7bdf8f
Reported-by: Jan Stodola <jstodola@redhat.com>
7bdf8f
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
7bdf8f
---
7bdf8f
 super1.c | 2 ++
7bdf8f
 1 file changed, 2 insertions(+)
7bdf8f
7bdf8f
diff --git a/super1.c b/super1.c
7bdf8f
index d6f3c93..8d5543f 100644
7bdf8f
--- a/super1.c
7bdf8f
+++ b/super1.c
7bdf8f
@@ -2016,6 +2016,8 @@ static int load_super1(struct supertype *st, int fd, char *devname)
7bdf8f
 		return 1;
7bdf8f
 	}
7bdf8f
 
7bdf8f
+	memset(super, 0, SUPER1_SIZE);
7bdf8f
+
7bdf8f
 	if (aread(&afd, super, MAX_SB_SIZE) != MAX_SB_SIZE) {
7bdf8f
 		if (devname)
7bdf8f
 			pr_err("Cannot read superblock on %s\n",
7bdf8f
-- 
7bdf8f
2.5.5
7bdf8f