import nvme-cli-1.14-3.el8

This commit is contained in:
CentOS Sources 2021-09-17 17:44:09 +00:00 committed by Stepan Oksanichenko
parent 46f2c9be4c
commit 6d93ab76d8
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 59e7477c5a18ec4bcb1f9b1e20d2303b4e0cafb1 Mon Sep 17 00:00:00 2001
From: Martin George <marting@netapp.com>
Date: Thu, 5 Aug 2021 18:01:24 +0530
Subject: [PATCH] nvme-print: fix 'nvme list' segfault if controller is
unavailable
Check if the controller is available before dereferencing the
controller attributes.
Signed-off-by: Martin George <marting@netapp.com>
---
nvme-print.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/nvme-print.c b/nvme-print.c
index 8a2cbc4..0c0ec3b 100755
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -6147,6 +6147,9 @@ static void nvme_show_list_item(struct nvme_namespace *n)
struct stat st;
int ret;
+ if (!n->ctrl)
+ return;
+
sprintf(path, "%s%s", n->ctrl->path, n->name);
ret = stat(path, &st);
if (ret < 0)
@@ -6203,6 +6206,9 @@ static void nvme_show_details_ns(struct nvme_namespace *n, bool ctrl)
char usage[128];
char format[128];
+ if (!n->ctrl)
+ return;
+
sprintf(usage,"%6.2f %2sB / %6.2f %2sB", nuse, u_suffix,
nsze, s_suffix);
sprintf(format,"%3.0f %2sB + %2d B", (double)lba, l_suffix,
@@ -6419,6 +6425,9 @@ static void json_simple_ns(struct nvme_namespace *n, struct json_object *devices
char *devnode;
struct stat st;
+ if (!n->ctrl)
+ return;
+
if (asprintf(&devnode, "%s%s", n->ctrl->path, n->name) < 0)
return;
--
2.27.0

View File

@ -3,7 +3,7 @@
Name: nvme-cli
Version: 1.14
Release: 2%{?dist}
Release: 3%{?dist}
Summary: NVMe management command line interface
License: GPLv2+
@ -16,6 +16,7 @@ Patch2: 0002-fabrics-skip-connect-if-transport-type-doesn-t-match.patch
Patch3: 0003-nvme-ioctl-return-1-on-failure-from-nvme_get_nsid.patch
Patch4: 0004-nvme-topology-scan-all-controllers-in-scan_subsystem.patch
Patch5: 0005-nvme-topology-fix-controller-check-in-scan_subsystem.patch
Patch6: 0006-nvme-print-fix-nvme-list-segfault-if-controller-is-u.patch
BuildRequires: libuuid-devel
BuildRequires: gcc
@ -34,6 +35,7 @@ nvme-cli provides NVM-Express user space tooling for Linux.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
@ -91,6 +93,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
fi
%changelog
* Mon Sep 13 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.14-3
- Fix crash when executing nvme-list
* Thu Jul 22 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.14-2
- Merge various bugfixes