multipath-tools/0046-libmultipath-check-for-null-wwid-before-strcmp.patch
jinzhiguang 7c750e20f5 fix multipathd service coredump caused by empty item in multipath.conf
Signed-off-by: jinzhiguang <jinzhiguang@kylinos.cn>
2024-05-30 13:39:40 +08:00

34 lines
1.1 KiB
Diff

From 0eeaa7d89ff46201aec2211db26ce08021cb292d Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 4 Jan 2021 21:59:54 -0600
Subject: [PATCH 1/1] libmultipath: check for null wwid before strcmp
Commit 749aabd0 (libmultipath: ignore multipaths sections without wwid
option) removed all mpentries with a NULL wwid, but didn't stop strcmp()
from being run on them in merge_mptable(). The result of strcmp() with
a NULL parameter is undefined, so fix that.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index a643703e..be310159 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -518,7 +518,7 @@ void merge_mptable(vector mptable)
}
j = i + 1;
vector_foreach_slot_after(mptable, mp2, j) {
- if (strcmp(mp1->wwid, mp2->wwid))
+ if (!mp2->wwid || strcmp(mp1->wwid, mp2->wwid))
continue;
condlog(1, "%s: duplicate multipath config section for %s",
__func__, mp1->wwid);
--
2.27.0