device-mapper-multipath-0.9.9-12

Add 0034-libmultipath-fix-crash-in-print_foreign_topology.patch
  * Fixes RHEL-107436 ("Running multipath -ll on system with "enable_foreign
    nvme" results in segfault")
Resolves: RHEL-107436
This commit is contained in:
Lin Li 2025-09-13 00:26:48 +08:00
parent 144daca133
commit ea1017df3f
2 changed files with 92 additions and 1 deletions

View File

@ -0,0 +1,84 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 20 Aug 2025 18:25:03 -0400
Subject: [PATCH] libmultipath: fix crash in print_foreign_topology
print_foreign_topology() called get_paths() to get a vector of
(struct gen_path *) items and then called get_multipath_layout__(),
which expects a vector of (struct gen_multipath *) items, with the path
vector. This can easily end badly. Fix it to correctly call
get_path_layout__(), and rename width to p_width in the functions that
end up calling snprint_multipath_topology__(), which is expecting to get
passed the path field widths.
Signed-off-by: Lin Li <lilin@redhat.com>
---
libmultipath/foreign.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libmultipath/foreign.c b/libmultipath/foreign.c
index d01a5ef0..b91e3898 100644
--- a/libmultipath/foreign.c
+++ b/libmultipath/foreign.c
@@ -500,7 +500,7 @@ void foreign_multipath_layout(fieldwidth_t *width)
}
static int __snprint_foreign_topology(struct strbuf *buf, int verbosity,
- const fieldwidth_t *width)
+ const fieldwidth_t *p_width)
{
struct foreign *fgn;
int i;
@@ -518,7 +518,7 @@ static int __snprint_foreign_topology(struct strbuf *buf, int verbosity,
if (vec != NULL) {
vector_foreach_slot(vec, gm, j) {
if (_snprint_multipath_topology(
- gm, buf, verbosity, width) < 0)
+ gm, buf, verbosity, p_width) < 0)
break;
}
}
@@ -530,7 +530,7 @@ static int __snprint_foreign_topology(struct strbuf *buf, int verbosity,
}
int snprint_foreign_topology(struct strbuf *buf, int verbosity,
- const fieldwidth_t *width)
+ const fieldwidth_t *p_width)
{
int rc;
@@ -540,7 +540,7 @@ int snprint_foreign_topology(struct strbuf *buf, int verbosity,
return 0;
}
pthread_cleanup_push(unlock_foreigns, NULL);
- rc = __snprint_foreign_topology(buf, verbosity, width);
+ rc = __snprint_foreign_topology(buf, verbosity, p_width);
pthread_cleanup_pop(1);
return rc;
}
@@ -550,9 +550,9 @@ void print_foreign_topology(int verbosity)
STRBUF_ON_STACK(buf);
struct foreign *fgn;
int i;
- fieldwidth_t *width __attribute__((cleanup(cleanup_ucharp))) = NULL;
+ fieldwidth_t *p_width __attribute__((cleanup(cleanup_ucharp))) = NULL;
- if ((width = alloc_path_layout()) == NULL)
+ if ((p_width = alloc_path_layout()) == NULL)
return;
rdlock_foreigns();
if (foreigns == NULL) {
@@ -566,11 +566,11 @@ void print_foreign_topology(int verbosity)
fgn->lock(fgn->context);
pthread_cleanup_push(fgn->unlock, fgn->context);
vec = fgn->get_paths(fgn->context);
- _get_multipath_layout(vec, LAYOUT_RESET_NOT, width);
+ _get_path_layout(vec, LAYOUT_RESET_NOT, p_width);
fgn->release_paths(fgn->context, vec);
pthread_cleanup_pop(1);
}
- __snprint_foreign_topology(&buf, verbosity, width);
+ __snprint_foreign_topology(&buf, verbosity, p_width);
pthread_cleanup_pop(1);
printf("%s", get_strbuf_str(&buf));
}

View File

@ -1,6 +1,6 @@
Name: device-mapper-multipath
Version: 0.9.9
Release: 11%{?dist}
Release: 12%{?dist}
Summary: Tools to manage multipath devices using device-mapper
License: GPLv2
URL: http://christophe.varoqui.free.fr/
@ -43,6 +43,7 @@ Patch0030: 0030-multipathd-monitor-new-multipath-dev-even-if-we-can-.patch
Patch0031: 0031-libmultipath-add-helper-function-check_path_wwid_cha.patch
Patch0032: 0032-multipathd-re-add-paths-skipped-because-they-were-of.patch
Patch0033: 0033-multipath-tools-add-HPE-MSA-Gen7-2070-2072-to-hwtabl.patch
Patch0034: 0034-libmultipath-fix-crash-in-print_foreign_topology.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -252,6 +253,12 @@ fi
%{_pkgconfdir}/libdmmp.pc
%changelog
* Sat Sep 13 2025 Lin Li <lilin@redhat.com> - 0.9.9-12
Add 0034-libmultipath-fix-crash-in-print_foreign_topology.patch
* Fixes RHEL-107436 ("Running multipath -ll on system with "enable_foreign
nvme" results in segfault")
Resolves: RHEL-107436
* Mon Jul 14 2025 Filip Suba <fsuba@redhat.com> - 0.9.9-11
- Add 0033-multipath-tools-add-HPE-MSA-Gen7-2070-2072-to-hwtabl.patch
* Fixes RHEL-103112 ("Update multipath builtin config to add new