diff --git a/0001-tree-handle-no-address-phy-slot-dirs.patch b/0001-tree-handle-no-address-phy-slot-dirs.patch new file mode 100644 index 0000000..e6fcdca --- /dev/null +++ b/0001-tree-handle-no-address-phy-slot-dirs.patch @@ -0,0 +1,32 @@ +From 49a4cd8f62d05bb4e1b6e1365bad638c366cdba9 Mon Sep 17 00:00:00 2001 +From: Greg Joyce +Date: Tue, 23 Jul 2024 01:04:42 +0530 +Subject: [PATCH] tree: handle no address phy slot dirs + +Not all directories have an address. Verify addr before calling +strcmp(). + +Fixes: 42ac45359635 ("tree: Add PCI physical slot number for controller") +Signed-off-by: Greg Joyce +--- + src/nvme/tree.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/nvme/tree.c b/src/nvme/tree.c +index 288b23c73a1b..b0ee94047634 100644 +--- a/src/nvme/tree.c ++++ b/src/nvme/tree.c +@@ -1867,6 +1867,10 @@ static char *nvme_ctrl_lookup_phy_slot(nvme_root_t r, const char *address) + return NULL; + } + addr = nvme_get_attr(path, "address"); ++ ++ /* some directories don't have an address entry */ ++ if (!addr) ++ continue; + if (strcmp(addr, target_addr) == 0) + return strdup(entry->d_name); + } +-- +2.43.0 + diff --git a/libnvme.spec b/libnvme.spec index 509ebfd..a181fd4 100644 --- a/libnvme.spec +++ b/libnvme.spec @@ -4,13 +4,14 @@ Name: libnvme Summary: Linux-native nvme device management library Version: 1.9 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPL-2.1-or-later URL: https://github.com/linux-nvme/libnvme Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz # https://issues.redhat.com/browse/RHEL-37608 Patch0: libnvme-1.10-uriparser.patch +Patch1: 0001-tree-handle-no-address-phy-slot-dirs.patch BuildRequires: gcc gcc-c++ BuildRequires: swig @@ -96,6 +97,9 @@ mv %{buildroot}/usr/*.rst %{buildroot}%{_pkgdocdir}/ %{python3_sitearch}/libnvme/* %changelog +* Thu Aug 01 2024 Maurizio Lombardi - 1.9-3 +- Backport fix for RHEL-49544 + * Wed Jul 24 2024 Tomas Bzatek - 1.9-2 - Backport URI parser API