File 0022-super1-don-t-allow-adding-a-bitmap-if-there-is-no-sp.patch of Package mdadm.5365
From 268cccac2e44e8e9166c9727e740d5d1f537b6a4 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 15 Aug 2014 15:45:54 +1000
Subject: [PATCH 030/359] super1: don't allow adding a bitmap if there is no
space.
References: bsc#1081910
If the data is too close to the superblock there may be
no space for a bitmap.
If that happens, fail the adding of the bitmap rather than
corrupt data.
Reported-by: Lars Wijtemans <rhelbugzilla@lars.wijtemans.nl>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=922944
Signed-off-by: Coly Li <colyli@suse.de>
---
super1.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/super1.c b/super1.c
index 9834594..02d6c7a 100644
--- a/super1.c
+++ b/super1.c
@@ -2105,6 +2105,10 @@ add_internal_bitmap1(struct supertype *st,
/* Limit to 128K of bitmap when chunk size not requested */
room = 128*2;
+ if (room <= 1)
+ /* No room for a bitmap */
+ return 0;
+
max_bits = (room * 512 - sizeof(bitmap_super_t)) * 8;
min_chunk = 4096; /* sub-page chunks don't work yet.. */
--
2.16.1