open-iscsi: backport two upstream bugfix patches

This commit is contained in:
ZhiqiangLiu 2020-06-15 21:33:35 +08:00
parent 56048679b5
commit 58d23e7c3d
3 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 05766f1e85ea7fbf975559d27814c769328c72dd Mon Sep 17 00:00:00 2001
From: liubo <liubo254@huawei.com>
Date: Thu, 4 Jun 2020 16:57:07 +0800
Subject: [PATCH] iscsi: Add break to while loop
Fix the potential risk of rc value being washed out by jumping out of the loop
Source Link: https://github.com/open-iscsi/open-iscsi/pull/211
Signed-off-by: liubo <liubo254@huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
utils/fwparam_ibft/fwparam_sysfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
index a0cd1c7..87fd6d4 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -115,8 +115,11 @@ static int get_iface_from_device(char *id, struct boot_context *context)
break;
}
- if (sscanf(dent->d_name, "net:%s", context->iface) != 1)
+ if (sscanf(dent->d_name, "net:%s", context->iface) != 1) {
rc = EINVAL;
+ break;
+ }
+
rc = 0;
break;
} else {
--
2.21.1 (Apple Git-122.3)

View File

@ -0,0 +1,33 @@
From e5c4073ae836cd049a4bc3d6c1291a25f88ad67d Mon Sep 17 00:00:00 2001
From: lixiaokeng <lixiaokeng@huawei.com>
Date: Thu, 4 Jun 2020 20:35:18 +0800
Subject: [PATCH] iscsi: fix fd leak
iscsi-review/utils/fwparam_ibft/fwparam_ibft.c: line 466
Before return -1, the fd was opend and not closed which would lead
to leak fd. Fix that.
Source Link: https://github.com/open-iscsi/open-iscsi/pull/212
Signed-off-by: lixiaokeng <lixiaokeng@huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
utils/fwparam_ibft/fwparam_ibft.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/fwparam_ibft/fwparam_ibft.c b/utils/fwparam_ibft/fwparam_ibft.c
index 52edac1..e68e503 100644
--- a/utils/fwparam_ibft/fwparam_ibft.c
+++ b/utils/fwparam_ibft/fwparam_ibft.c
@@ -463,6 +463,7 @@ fwparam_ibft(struct boot_context *context, const char *filepath)
if (stat(filename, &buf)!=0) {
fprintf(stderr, "Could not stat file %s: %s (%d)\n",
filename, strerror(errno), errno);
+ close(fd);
return -1;
}
/* And if not zero use that size */
--
2.21.1 (Apple Git-122.3)

View File

@ -4,7 +4,7 @@
Name: open-iscsi
Version: 2.0.876
Release: 19
Release: 20
Summary: ISCSI software initiator daemon and utility programs
License: GPLv2+ and BSD
URL: http://www.open-iscsi.org
@ -54,6 +54,8 @@ Patch0039: 0039-iscsi-iname-verify-prefix-length-is-at-most-210.patch
Patch0040: 0040-iscsi-iname-remove-unneeded-temp-buffer.patch
Patch0041: 0041-Fix-issue-where-iscsi-iname-p-core-dumps.patch
Patch0042: 0042-modify-iSCSI-shared-memory-permissions-for-logs.patch
Patch0043: 0043-iscsi-Add-break-to-while-loop.patch
Patch0044: 0044-iscsi-fix-fd-leak.patch
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel
BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config gdb
@ -186,6 +188,9 @@ fi
%{_mandir}/man8/*
%changelog
* Mon Jun 15 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 2.0.876-20
- Backport two upstream bugfix patches
* Tue May 12 2020 Wu Bo <wubo@huawei.com> - 2.0.876-19
- iscsi-iname verfiy prefix length is at most 210 characters.
iscsi-iname remove unneeded temp buffer.