Blame SOURCES/lvm2-2_03_12-integrity-fix-segfault-on-error-path-when-replacing-.patch

abb29f
 lib/metadata/integrity_manip.c | 10 +++++++---
abb29f
 1 file changed, 7 insertions(+), 3 deletions(-)
abb29f
abb29f
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
abb29f
index 53ab1b3..abf90d8 100644
abb29f
--- a/lib/metadata/integrity_manip.c
abb29f
+++ b/lib/metadata/integrity_manip.c
abb29f
@@ -773,9 +773,13 @@ int lv_add_integrity_to_raid(struct logical_volume *lv, struct integrity_setting
abb29f
 bad:
abb29f
 	log_error("Failed to add integrity.");
abb29f
 
abb29f
-	for (s = 0; s < revert_meta_lvs; s++) {
abb29f
-		if (!lv_remove(imeta_lvs[s]))
abb29f
-			log_error("New integrity metadata LV may require manual removal.");
abb29f
+	if (revert_meta_lvs) {
abb29f
+		for (s = 0; s < DEFAULT_RAID_MAX_IMAGES; s++) {
abb29f
+			if (!imeta_lvs[s])
abb29f
+				continue;
abb29f
+			if (!lv_remove(imeta_lvs[s]))
abb29f
+				log_error("New integrity metadata LV may require manual removal.");
abb29f
+		}
abb29f
 	}
abb29f
 			       
abb29f
 	if (!vg_write(vg) || !vg_commit(vg))