!7 ndctl在master分支升级到v71.1版本

From: @liuzhiqiang26
Reviewed-by: 
Signed-off-by:
This commit is contained in:
openeuler-ci-bot 2021-01-28 17:38:24 +08:00 committed by Gitee
commit 61de1f5964
5 changed files with 12 additions and 77 deletions

View File

@ -1,32 +0,0 @@
From b0d9cad81f2e811608b898922643f655043361aa Mon Sep 17 00:00:00 2001
From: Vishal Verma <vishal.l.verma@intel.com>
Date: Tue, 21 Jul 2020 23:17:27 -0600
Subject: [PATCH 1/2] ndctl/namespace: fix a resource leak in
file_write_infoblock()
Static analysis showed that we might leak 'fd' in the given function.
Fix the error path to close(fd) if 'fd >= 0' rather than just 'fd > 0'.
Fixes: 7787807bcffe ("ndctl/namespace: Add write-infoblock command")
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
ndctl/namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 0550580..17e67c9 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1977,7 +1977,7 @@ static int file_write_infoblock(const char *path)
free(buf);
out:
- if (fd > 0 && fd != STDOUT_FILENO)
+ if (fd >= 0 && fd != STDOUT_FILENO)
close(fd);
return rc;
}
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From 2f99e11812e6a4d9814bfc8ef038ca845db5394c Mon Sep 17 00:00:00 2001
From: Vishal Verma <vishal.l.verma@intel.com>
Date: Thu, 1 Oct 2020 11:10:00 -0600
Subject: [PATCH 2/2] libndctl: fix a potential buffer overflow
Static analysis points out that the 'buf' in ndctl_dimm_is_active was
inappropriately sized. We already have 'SYSFS_ATTR_SIZE' for such
buffers, and it looks like this was just an oversight.
Fixes: 0a4509d7de2f ("ndctl: enumerate interleave sets")
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
ndctl/lib/libndctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index ee737cb..5b276a7 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -3292,8 +3292,8 @@ NDCTL_EXPORT int ndctl_dimm_is_active(struct ndctl_dimm *dimm)
{
struct ndctl_ctx *ctx = ndctl_dimm_get_ctx(dimm);
char *path = dimm->dimm_buf;
+ char buf[SYSFS_ATTR_SIZE];
int len = dimm->buf_len;
- char buf[20];
if (snprintf(path, len, "%s/state", dimm->dimm_path) >= len) {
err(ctx, "%s: buffer too small!\n",
--
1.8.3.1

Binary file not shown.

BIN
ndctl-71.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,15 +1,12 @@
Name: ndctl
Version: 68
Release: 2
Version: 71.1
Release: 1
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory)
License: GPLv2
License: GPL-2, LGPL-2.1, MIT, CC0-1.0
Group: System Environment/Base
Url: https://github.com/pmem/ndctl
Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch1: 0001-ndctl-namespace-fix-a-resource-leak-in-file_write_in.patch
Patch2: 0002-libndctl-fix-a-potential-buffer-overflow.patch
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
BuildRequires: autoconf
@ -116,7 +113,7 @@ make check
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion)
%files
%license util/COPYING licenses/BSD-MIT licenses/CC0
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_bindir}/ndctl
%{_mandir}/man1/ndctl*
%{bashcompdir}/
@ -126,35 +123,38 @@ make check
%{_sysconfdir}/modprobe.d/nvdimm-security.conf
%files -n daxctl
%license util/COPYING licenses/BSD-MIT licenses/CC0
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_bindir}/daxctl
%{_mandir}/man1/daxctl*
%{_datadir}/daxctl/daxctl.conf
%files -n ndctl-libs
%doc README.md
%license COPYING licenses/BSD-MIT licenses/CC0
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_libdir}/libndctl.so.*
%files -n daxctl-libs
%doc README.md
%license COPYING licenses/BSD-MIT licenses/CC0
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_libdir}/libdaxctl.so.*
%files -n ndctl-devel
%license COPYING
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/ndctl/
%{_libdir}/libndctl.so
%{_libdir}/pkgconfig/libndctl.pc
%files -n daxctl-devel
%license COPYING
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/daxctl/
%{_libdir}/libdaxctl.so
%{_libdir}/pkgconfig/libdaxctl.pc
%changelog
* Thu Jan 28 2021 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 71.1-1
- update ndctl to v71.1 latest version
* Fri Oct 30 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 68-2
- backport upstream patches to fix some potential problems