diff --git a/0045-libmultipath-ignore-multipaths-sections-without-wwid.patch b/0045-libmultipath-ignore-multipaths-sections-without-wwid.patch new file mode 100644 index 0000000000000000000000000000000000000000..a4340a2d4d9b8af79cefd7daa0b30236644bb4af --- /dev/null +++ b/0045-libmultipath-ignore-multipaths-sections-without-wwid.patch @@ -0,0 +1,38 @@ +From 749aabd0f5e6d662e552f0d712434696743fe69b Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Fri, 18 Dec 2020 17:06:40 -0600 +Subject: [PATCH 1/1] libmultipath: ignore multipaths sections without wwid + option + +"multipathd show config local" was crashing in find_mp_by_wwid() if +the multipath configuration included a multipaths section that did +not set a wwid option. There is no reason to keep a mpentry that +didn't set its wwid. Remove it in merge_mptable(). + +Signed-off-by: Benjamin Marzinski +Reviewed-by: Martin Wilck +--- + libmultipath/config.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/libmultipath/config.c b/libmultipath/config.c +index 9f3cb38d..a643703e 100644 +--- a/libmultipath/config.c ++++ b/libmultipath/config.c +@@ -509,6 +509,13 @@ void merge_mptable(vector mptable) + int i, j; + + vector_foreach_slot(mptable, mp1, i) { ++ /* drop invalid multipath configs */ ++ if (!mp1->wwid) { ++ condlog(0, "multipaths config section missing wwid"); ++ vector_del_slot(mptable, i--); ++ free_mpe(mp1); ++ continue; ++ } + j = i + 1; + vector_foreach_slot_after(mptable, mp2, j) { + if (strcmp(mp1->wwid, mp2->wwid)) +-- +2.27.0 + diff --git a/0046-libmultipath-check-for-null-wwid-before-strcmp.patch b/0046-libmultipath-check-for-null-wwid-before-strcmp.patch new file mode 100644 index 0000000000000000000000000000000000000000..3a3d5960a6bdb16e7b3693eb453b1ad777beacd1 --- /dev/null +++ b/0046-libmultipath-check-for-null-wwid-before-strcmp.patch @@ -0,0 +1,33 @@ +From 0eeaa7d89ff46201aec2211db26ce08021cb292d Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +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 + +Reviewed-by: Martin Wilck +--- + 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 + diff --git a/multipath-tools.spec b/multipath-tools.spec index 08aa583831dff2c7e5483424c9dcc103eb809c4d..31482e9f26e79628a8066cf912e4faf2de473329 100644 --- a/multipath-tools.spec +++ b/multipath-tools.spec @@ -2,7 +2,7 @@ Name: multipath-tools Version: 0.8.4 -Release: 21 +Release: 22 Summary: Tools to manage multipath devices with the device-mapper License: GPL-2.0-or-later and LGPL-2.0-only URL: http://christophe.varoqui.free.fr/ @@ -54,6 +54,8 @@ Patch41: 0041-libmultipath-make-sysfs_is_multipathed-able-to-retur.patch Patch42: 0042-multipath-centralize-validation-code.patch Patch43: 0043-libmultipath-dm_map_present_by_uuid-fix-dm_task_crea.patch Patch44: 0044-multipathd.socket-add-missing-conditions-from-servic.patch +Patch45: 0045-libmultipath-ignore-multipaths-sections-without-wwid.patch +Patch46: 0046-libmultipath-check-for-null-wwid-before-strcmp.patch BuildRequires: multipath-tools, libcmocka, libcmocka-devel BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 @@ -201,6 +203,9 @@ fi %changelog +* Wed May 29 2024 jinzhiguang - -0.8.4-22 +- fix multipathd service coredump caused by empty item in multipath.conf + * Wed May 22 2024 kouwenqi - 0.8.4-21 - multipathd.socket: add missing conditions from service unit