Blame SOURCES/0046-libmultipath-ignore-multipaths-sections-without-wwid.patch

b7337d
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b7337d
From: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
Date: Mon, 16 Nov 2020 16:38:21 -0600
b7337d
Subject: [PATCH] libmultipath: ignore multipaths sections without wwid option
b7337d
b7337d
"multipathd show config local" was crashing in find_mp_by_wwid() if
b7337d
the multipath configuration included a multipaths section that did
b7337d
not set a wwid option. There is no reason to keep a mpentry that
b7337d
didn't set its wwid. Remove it in merge_mptable().
b7337d
b7337d
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
---
b7337d
 libmultipath/config.c | 7 +++++++
b7337d
 1 file changed, 7 insertions(+)
b7337d
b7337d
diff --git a/libmultipath/config.c b/libmultipath/config.c
b7337d
index a71db2d0..dc81c994 100644
b7337d
--- a/libmultipath/config.c
b7337d
+++ b/libmultipath/config.c
b7337d
@@ -444,6 +444,13 @@ void merge_mptable(vector mptable)
b7337d
 	int i, j;
b7337d
 
b7337d
 	vector_foreach_slot(mptable, mp1, i) {
b7337d
+		/* drop invalid multipath configs */
b7337d
+		if (!mp1->wwid) {
b7337d
+			condlog(0, "multipaths config section missing wwid");
b7337d
+			vector_del_slot(mptable, i--);
b7337d
+			free_mpe(mp1);
b7337d
+			continue;
b7337d
+		}
b7337d
 		j = i + 1;
b7337d
 		vector_foreach_slot_after(mptable, mp2, j) {
b7337d
 			if (strcmp(mp1->wwid, mp2->wwid))
b7337d
-- 
b7337d
2.17.2
b7337d