device-mapper-multipath/0091-libmultipath-check-for-null-wwid-before-strcmp.patch
Benjamin Marzinski b05147c356 device-mapper-multipath-0.8.5-6
Change patch format to remove Git version
  * Patches 0001-0122 only have the patch format modified
Update to the head of the upstream staging branch plus redhat patches
  * Patches 0123-0134 & 1036-0142 are from the upstream staging branch
  * Patches 0143-1046 have been submitted upstream
  * Patch 0156 is a Red Hat only patch. Red Hat udev rules set ID_SERIAL
    from 60-persistent-storage.rules instead of 55-scsi-sg3_id.rules.
    Multipath's parse_vpd_pg83() function needs to match the ID_SERIAL
    value from udev.
Rename files
  * Previous patches 0123-0132 are now patches 1035 & 0147-0155
2021-03-26 13:33:56 -05:00

32 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 4 Jan 2021 21:59:54 -0600
Subject: [PATCH] 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>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.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);