Compare commits
10 Commits
c7cd483329
...
d9c3e516c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9c3e516c6 | ||
|
|
2772524cf2 | ||
|
|
eb36b808e5 | ||
|
|
dfa8e858f1 | ||
|
|
044628e692 | ||
|
|
cfbc7ef4da | ||
|
|
8f7a9b725f | ||
|
|
ae288cec04 | ||
|
|
0d55b0b1d6 | ||
|
|
894d9b4d4a |
41
0017-Updata-iscsi-dd.c.patch
Normal file
41
0017-Updata-iscsi-dd.c.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 8592dc58838872d0d49c3d773df950f0b3e1eb4b Mon Sep 17 00:00:00 2001
|
||||||
|
From: sallyjunjun <72725839+sallyjunjun@users.noreply.github.com>
|
||||||
|
Date: Tue, 31 May 2022 14:20:43 +0800
|
||||||
|
Subject: [PATCH 1/4] Update iscsi-dd.c
|
||||||
|
|
||||||
|
add check after malloc to avoid referencing an illegal pointer
|
||||||
|
---
|
||||||
|
examples/iscsi-dd.c | 10 ++++++++++
|
||||||
|
1 file changed, 10 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/examples/iscsi-dd.c b/examples/iscsi-dd.c
|
||||||
|
index b2d41ac..1f7ae9f 100644
|
||||||
|
--- a/examples/iscsi-dd.c
|
||||||
|
+++ b/examples/iscsi-dd.c
|
||||||
|
@@ -131,6 +131,11 @@ void read_cb(struct iscsi_context *iscsi, int status, void *command_data, void *
|
||||||
|
}
|
||||||
|
|
||||||
|
wt = malloc(sizeof(struct write_task));
|
||||||
|
+ if (wt == NULL) {
|
||||||
|
+ fprintf(stderr, "failed to alloc write task\n");
|
||||||
|
+ exit(10);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wt->rt = task;
|
||||||
|
wt->client = client;
|
||||||
|
|
||||||
|
@@ -430,6 +435,11 @@ void cscd_ident_inq(struct iscsi_context *iscsi,
|
||||||
|
_tgt_desig->designator_type = tgt_desig->designator_type;
|
||||||
|
_tgt_desig->designator_length = tgt_desig->designator_length;
|
||||||
|
_tgt_desig->designator = malloc(tgt_desig->designator_length);
|
||||||
|
+ if (_tgt_desig->designator == NULL) {
|
||||||
|
+ fprintf(stderr, "failed to alloc designator\n");
|
||||||
|
+ exit(10);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
memcpy(_tgt_desig->designator, tgt_desig->designator, tgt_desig->designator_length);
|
||||||
|
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
47
0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch
Normal file
47
0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
From b087a09a0b7754765d3d646c20b5a122eb2b3847 Mon Sep 17 00:00:00 2001
|
||||||
|
From: sallyjunjun <72725839+sallyjunjun@users.noreply.github.com>
|
||||||
|
Date: Tue, 31 May 2022 17:21:09 +0800
|
||||||
|
Subject: [PATCH 2/4] iscsi-swp: handle setting of debug_level correctly
|
||||||
|
|
||||||
|
According to the man page and help info, --debug=integer can specify the
|
||||||
|
debug_level, while it would report following error:
|
||||||
|
|
||||||
|
iscsi-swp --debug=1
|
||||||
|
iscsi-swp: option '--debug' doesn't allow an argument
|
||||||
|
---
|
||||||
|
utils/iscsi-swp.c | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/utils/iscsi-swp.c b/utils/iscsi-swp.c
|
||||||
|
index af07c81..8c2ca31 100644
|
||||||
|
--- a/utils/iscsi-swp.c
|
||||||
|
+++ b/utils/iscsi-swp.c
|
||||||
|
@@ -75,14 +75,14 @@ int main(int argc, char *argv[])
|
||||||
|
static struct option long_options[] = {
|
||||||
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{"usage", no_argument, NULL, 'u'},
|
||||||
|
- {"debug", no_argument, NULL, 'd'},
|
||||||
|
+ {"debug", required_argument, NULL, 'd'},
|
||||||
|
{"initiator-name", required_argument, NULL, 'i'},
|
||||||
|
{"swp", required_argument, NULL, 's'},
|
||||||
|
{0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
int option_index;
|
||||||
|
|
||||||
|
- while ((c = getopt_long(argc, argv, "h?udi:s:", long_options,
|
||||||
|
+ while ((c = getopt_long(argc, argv, "h?ud:i:s:", long_options,
|
||||||
|
&option_index)) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'h':
|
||||||
|
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||||
|
show_usage = 1;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
- debug = 1;
|
||||||
|
+ debug = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
initiator = optarg;
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
121
0019-fix-iscsi-ls-parameter-parse.patch
Normal file
121
0019-fix-iscsi-ls-parameter-parse.patch
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
From 045c2387e77f2c20359e956e3327b006e5814cc6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: sallyjunjun <72725839+sallyjunjun@users.noreply.github.com>
|
||||||
|
Date: Wed, 8 Jun 2022 10:02:04 +0800
|
||||||
|
Subject: [PATCH 3/4] fix iscsi-ls parameter parse
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
If invalid option is input with iscsi-ls, such as "iscsi-ls -a iscsi://", the command just stuck here and do not print useful information for the user to correct.
|
||||||
|
Fix this problem with getopt_long.
|
||||||
|
---
|
||||||
|
utils/iscsi-ls.c | 64 ++++++++++++++++++++++++++++++++++++--------------------
|
||||||
|
1 file changed, 41 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/utils/iscsi-ls.c b/utils/iscsi-ls.c
|
||||||
|
index 2b1d5e2..107121d 100644
|
||||||
|
--- a/utils/iscsi-ls.c
|
||||||
|
+++ b/utils/iscsi-ls.c
|
||||||
|
@@ -37,6 +37,7 @@ WSADATA wsaData;
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
+#include <getopt.h>
|
||||||
|
#include "iscsi.h"
|
||||||
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
|
@@ -329,7 +330,7 @@ void print_help(void)
|
||||||
|
fprintf(stderr, " -i, --initiator-name=iqn-name Initiatorname to use\n");
|
||||||
|
fprintf(stderr, " -d, --debug Print debug information\n");
|
||||||
|
fprintf(stderr, " -s, --show-luns Show the luns for each target\n");
|
||||||
|
- fprintf(stderr, " --url Output targets in URL format\n");
|
||||||
|
+ fprintf(stderr, " -U, --url Output targets in URL format\n");
|
||||||
|
fprintf(stderr, " (does not work with -s)\n");
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
fprintf(stderr, "Help options:\n");
|
||||||
|
@@ -350,7 +351,8 @@ int main(int argc, char *argv[])
|
||||||
|
struct iscsi_url *iscsi_url = NULL;
|
||||||
|
struct client_state state;
|
||||||
|
const char *url = NULL;
|
||||||
|
- int i;
|
||||||
|
+ int c;
|
||||||
|
+ int option_index;
|
||||||
|
static int show_help = 0, show_usage = 0, debug = 0;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
@@ -360,31 +362,44 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- for (i = 1; i < argc; i++) {
|
||||||
|
- if (!strcmp(argv[i], "-?") ||
|
||||||
|
- !strcmp(argv[i], "-h") ||
|
||||||
|
- !strcmp(argv[i], "--help")) {
|
||||||
|
- show_help = 1;
|
||||||
|
- } else if (!strcmp(argv[i], "-u") ||
|
||||||
|
- !strcmp(argv[i], "-usage")) {
|
||||||
|
+ static struct option long_options[] = {
|
||||||
|
+ {"help", no_argument, NULL, 'h'},
|
||||||
|
+ {"usage", no_argument, NULL, 'u'},
|
||||||
|
+ {"debug", no_argument, NULL, 'd'},
|
||||||
|
+ {"initiator-name", required_argument, NULL, 'i'},
|
||||||
|
+ {"show-luns", no_argument, NULL, 's'},
|
||||||
|
+ {"url", no_argument, NULL, 'U'},
|
||||||
|
+ {0, 0, 0, 0}
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ while ((c = getopt_long(argc, argv, "h?udi:sU", long_options,
|
||||||
|
+ &option_index)) != -1) {
|
||||||
|
+ switch (c) {
|
||||||
|
+ case 'h':
|
||||||
|
+ case '?':
|
||||||
|
+ show_help = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 'u':
|
||||||
|
show_usage = 1;
|
||||||
|
- } else if (!strcmp(argv[i], "-d") ||
|
||||||
|
- !strcmp(argv[i], "--debug")) {
|
||||||
|
+ break;
|
||||||
|
+ case 'd':
|
||||||
|
debug = 1;
|
||||||
|
- } else if (!strcmp(argv[i], "-i") ||
|
||||||
|
- !strcmp(argv[i], "--initiator-name")) {
|
||||||
|
- initiator = argv[++i];
|
||||||
|
- } else if (!strcmp(argv[i], "-s") ||
|
||||||
|
- !strcmp(argv[i], "--show-luns")) {
|
||||||
|
+ break;
|
||||||
|
+ case 'i':
|
||||||
|
+ initiator = optarg;
|
||||||
|
+ break;
|
||||||
|
+ case 's':
|
||||||
|
showluns = 1;
|
||||||
|
- } else if (!strcmp(argv[i], "-U") ||
|
||||||
|
- !strcmp(argv[i], "--url")) {
|
||||||
|
+ break;
|
||||||
|
+ case 'U':
|
||||||
|
useurls = 1;
|
||||||
|
- } else if (!strncmp("iscsi://", argv[i], 8) ||
|
||||||
|
- !strncmp("iser://", argv[i], 7)) {
|
||||||
|
- url = strdup(argv[i]);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ fprintf(stderr, "Unrecognized option '%c'\n\n", c);
|
||||||
|
+ print_help();
|
||||||
|
+ exit(0);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (show_help != 0) {
|
||||||
|
print_help();
|
||||||
|
@@ -398,6 +413,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
memset(&state, 0, sizeof(state));
|
||||||
|
|
||||||
|
+ if (argv[optind] != NULL) {
|
||||||
|
+ url = strdup(argv[optind]);
|
||||||
|
+ }
|
||||||
|
if (url == NULL) {
|
||||||
|
fprintf(stderr, "You must specify iscsi target portal.\n");
|
||||||
|
print_usage();
|
||||||
98
0020-Check-return-value-of-scsi_malloc-in-order-to.patch
Normal file
98
0020-Check-return-value-of-scsi_malloc-in-order-to.patch
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
From acd147cb884f170ddac027881a9b4bb12a36ee2e Mon Sep 17 00:00:00 2001
|
||||||
|
From: geruijun <geruijun@huawei.com>
|
||||||
|
Date: Wed, 16 Mar 2022 01:36:22 +0800
|
||||||
|
Subject: [PATCH 4/4] Check return value of scsi_malloc in order to avoid
|
||||||
|
dereferencing NULL return value.
|
||||||
|
|
||||||
|
Signed-off-by: geruijun <geruijun@huawei.com>
|
||||||
|
---
|
||||||
|
lib/scsi-lowlevel.c | 30 ++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 30 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c
|
||||||
|
index 4039cea..0161852 100644
|
||||||
|
--- a/lib/scsi-lowlevel.c
|
||||||
|
+++ b/lib/scsi-lowlevel.c
|
||||||
|
@@ -2912,9 +2912,15 @@ scsi_modesense_marshall_caching(struct scsi_task *task,
|
||||||
|
struct scsi_data *data;
|
||||||
|
|
||||||
|
data = scsi_malloc(task, sizeof(struct scsi_data));
|
||||||
|
+ if (data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->size = 20 + hdr_size;
|
||||||
|
data->data = scsi_malloc(task, data->size);
|
||||||
|
+ if (data->data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (mp->caching.ic) data->data[hdr_size + 2] |= 0x80;
|
||||||
|
if (mp->caching.abpf) data->data[hdr_size + 2] |= 0x40;
|
||||||
|
@@ -2953,9 +2959,15 @@ scsi_modesense_marshall_control(struct scsi_task *task,
|
||||||
|
struct scsi_data *data;
|
||||||
|
|
||||||
|
data = scsi_malloc(task, sizeof(struct scsi_data));
|
||||||
|
+ if (data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->size = 12 + hdr_size;
|
||||||
|
data->data = scsi_malloc(task, data->size);
|
||||||
|
+ if (data->data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->data[hdr_size + 2] |= (mp->control.tst << 5) & 0xe0;
|
||||||
|
if (mp->control.tmf_only) data->data[hdr_size + 2] |= 0x10;
|
||||||
|
@@ -2993,9 +3005,15 @@ scsi_modesense_marshall_power_condition(struct scsi_task *task,
|
||||||
|
struct scsi_data *data;
|
||||||
|
|
||||||
|
data = scsi_malloc(task, sizeof(struct scsi_data));
|
||||||
|
+ if (data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->size = 40 + hdr_size;
|
||||||
|
data->data = scsi_malloc(task, data->size);
|
||||||
|
+ if (data->data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->data[hdr_size + 2] |=
|
||||||
|
(mp->power_condition.pm_bg_precedence << 6) & 0xc0;
|
||||||
|
@@ -3035,9 +3053,15 @@ scsi_modesense_marshall_disconnect_reconnect(struct scsi_task *task,
|
||||||
|
struct scsi_data *data;
|
||||||
|
|
||||||
|
data = scsi_malloc(task, sizeof(struct scsi_data));
|
||||||
|
+ if (data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->size = 16 + hdr_size;
|
||||||
|
data->data = scsi_malloc(task, data->size);
|
||||||
|
+ if (data->data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->data[hdr_size + 2] = mp->disconnect_reconnect.buffer_full_ratio;
|
||||||
|
data->data[hdr_size + 3] = mp->disconnect_reconnect.buffer_empty_ratio;
|
||||||
|
@@ -3064,9 +3088,15 @@ scsi_modesense_marshall_informational_exceptions_control(struct scsi_task *task,
|
||||||
|
struct scsi_data *data;
|
||||||
|
|
||||||
|
data = scsi_malloc(task, sizeof(struct scsi_data));
|
||||||
|
+ if (data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
data->size = 12 + hdr_size;
|
||||||
|
data->data = scsi_malloc(task, data->size);
|
||||||
|
+ if (data->data == NULL) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (mp->iec.perf) data->data[hdr_size + 2] |= 0x80;
|
||||||
|
if (mp->iec.ebf) data->data[hdr_size + 2] |= 0x20;
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
34
0021-Fix-segmentation-fault-problem.patch
Normal file
34
0021-Fix-segmentation-fault-problem.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 00310fdc2ff77fac84d871a76af67750eacb8594 Mon Sep 17 00:00:00 2001
|
||||||
|
From: geruijun <geruijun@huawei.com>
|
||||||
|
Date: Wed, 15 Jun 2022 10:06:40 +0800
|
||||||
|
Subject: [PATCH] Fix segmentation fault problem.
|
||||||
|
|
||||||
|
When execute iscsi_task_mgmt_lun_reset_async function,
|
||||||
|
pdus are already removed from waitpdu list. In iscsi_service
|
||||||
|
function, this will call iscsi_process_pdu and release
|
||||||
|
pdu from waitpdu again, which cause segmentation fault.
|
||||||
|
|
||||||
|
Whether waitpud list is NULL should be checked here to avoid
|
||||||
|
the problem.
|
||||||
|
|
||||||
|
Signed-off-by: geruijun <geruijun@huawei.com>
|
||||||
|
---
|
||||||
|
lib/pdu.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/pdu.c b/lib/pdu.c
|
||||||
|
index 6fe70db..f9c0bc5 100644
|
||||||
|
--- a/lib/pdu.c
|
||||||
|
+++ b/lib/pdu.c
|
||||||
|
@@ -622,7 +622,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (is_finished) {
|
||||||
|
+ if (is_finished && iscsi->waitpdu != NULL) {
|
||||||
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
|
iscsi->drv->free_pdu(iscsi, pdu);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
31
0022-init-fix-memory-leak-in-iscsi_create_context.patch
Normal file
31
0022-init-fix-memory-leak-in-iscsi_create_context.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From a391176a6dece09454672c6522778d6513e90fb4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhenwei pi <pizhenwei@bytedance.com>
|
||||||
|
Date: Tue, 25 Feb 2020 22:35:54 +0800
|
||||||
|
Subject: [PATCH] init: fix memory leak in iscsi_create_context
|
||||||
|
|
||||||
|
iscsi instance is allocated in iscsi_create_context, after we return
|
||||||
|
NULL, nobody could handle it anymore.
|
||||||
|
|
||||||
|
Currently we can't hit this logic, anyway we still fix this.
|
||||||
|
|
||||||
|
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
|
||||||
|
---
|
||||||
|
lib/init.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/init.c b/lib/init.c
|
||||||
|
index 13098f0..f3e2e13 100644
|
||||||
|
--- a/lib/init.c
|
||||||
|
+++ b/lib/init.c
|
||||||
|
@@ -218,7 +218,7 @@ iscsi_create_context(const char *initiator_name)
|
||||||
|
|
||||||
|
/* initalize transport of context */
|
||||||
|
if (iscsi_init_transport(iscsi, TCP_TRANSPORT)) {
|
||||||
|
- iscsi_set_error(iscsi, "Failed allocating transport");
|
||||||
|
+ free(iscsi);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
||||||
34
0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch
Normal file
34
0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 2674070fb80ad7527589a1fbd576ee074d26ed72 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Raphael Norwitz <raphael.norwitz@nutanix.com>
|
||||||
|
Date: Tue, 1 Mar 2022 18:03:48 -0500
|
||||||
|
Subject: [PATCH] iscsi-command: Fix leak in iscsi_send_data_out
|
||||||
|
|
||||||
|
In iscsi_send_data_out() a PDU is allocated, but there is no error
|
||||||
|
handling logic to free it if the PDU cannot be queued.
|
||||||
|
iscsi_allocate_pdu() may allocate memory for the PDU. This memory may be
|
||||||
|
leaked if iscsi_queue_pdu() fails since there is no call to free it.
|
||||||
|
|
||||||
|
Orignally there was a free() call but it was removed as a part of a
|
||||||
|
cleanup adding checks for NULL pdu callbacks.
|
||||||
|
|
||||||
|
Fixes: 423b82efa4bd ("pdu: check callback for NULL everywhere")
|
||||||
|
Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
|
||||||
|
---
|
||||||
|
lib/iscsi-command.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c
|
||||||
|
index a4df637..9a240ab 100644
|
||||||
|
--- a/lib/iscsi-command.c
|
||||||
|
+++ b/lib/iscsi-command.c
|
||||||
|
@@ -131,6 +131,7 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu,
|
||||||
|
if (iscsi_queue_pdu(iscsi, pdu) != 0) {
|
||||||
|
iscsi_set_error(iscsi, "Out-of-memory: failed to queue iscsi "
|
||||||
|
"scsi pdu.");
|
||||||
|
+ iscsi->drv->free_pdu(iscsi, pdu);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
||||||
27
0024-fix-segmentation-fault.patch
Normal file
27
0024-fix-segmentation-fault.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From abedc1848cf6305f2c1f20078710755c66415d2d Mon Sep 17 00:00:00 2001
|
||||||
|
From: folkert van heusden <mail@vanheusden.com>
|
||||||
|
Date: Tue, 30 Jan 2024 15:33:20 +0100
|
||||||
|
Subject: [PATCH] Fix for https://github.com/sahlberg/libiscsi/issues/409
|
||||||
|
'ms->pages' was not checked for being NULL. This can happen when a target
|
||||||
|
does not return any pages.
|
||||||
|
|
||||||
|
---
|
||||||
|
test-tool/iscsi-support.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c
|
||||||
|
index 169d2b0..ea9f711 100644
|
||||||
|
--- a/test-tool/iscsi-support.c
|
||||||
|
+++ b/test-tool/iscsi-support.c
|
||||||
|
@@ -2740,7 +2740,7 @@ int set_swp(struct scsi_device *sdev)
|
||||||
|
logging(LOG_VERBOSE, "[SUCCESS] CONTROL page fetched.");
|
||||||
|
|
||||||
|
ms = scsi_datain_unmarshall(sense_task);
|
||||||
|
- if (ms == NULL) {
|
||||||
|
+ if (ms == NULL || ms->pages == NULL) {
|
||||||
|
logging(LOG_NORMAL, "failed to unmarshall mode sense datain "
|
||||||
|
"blob");
|
||||||
|
ret = -1;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: libiscsi
|
Name: libiscsi
|
||||||
Version: 1.19.0
|
Version: 1.19.0
|
||||||
Release: 7
|
Release: 11
|
||||||
Summary: Client-side library to implement the iSCSI protocol
|
Summary: Client-side library to implement the iSCSI protocol
|
||||||
Recommends: %{name}-utils
|
Recommends: %{name}-utils
|
||||||
License: LGPLv2+ and GPLv2+
|
License: LGPLv2+ and GPLv2+
|
||||||
@ -22,6 +22,14 @@ Patch13: 0013-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch
|
|||||||
Patch14: 0014-iser-remove-__packed-from-struct-iser_cm_hdr-declaration.patch
|
Patch14: 0014-iser-remove-__packed-from-struct-iser_cm_hdr-declaration.patch
|
||||||
Patch15: 0015-test-tools-use-extern-init-in-headers.patch
|
Patch15: 0015-test-tools-use-extern-init-in-headers.patch
|
||||||
Patch16: 0016-iscsi-inq-handle-setting-of-debug_level-correctly.patch
|
Patch16: 0016-iscsi-inq-handle-setting-of-debug_level-correctly.patch
|
||||||
|
Patch17: 0017-Updata-iscsi-dd.c.patch
|
||||||
|
Patch18: 0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch
|
||||||
|
Patch19: 0019-fix-iscsi-ls-parameter-parse.patch
|
||||||
|
Patch20: 0020-Check-return-value-of-scsi_malloc-in-order-to.patch
|
||||||
|
Patch21: 0021-Fix-segmentation-fault-problem.patch
|
||||||
|
Patch22: 0022-init-fix-memory-leak-in-iscsi_create_context.patch
|
||||||
|
Patch23: 0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch
|
||||||
|
Patch24: 0024-fix-segmentation-fault.patch
|
||||||
|
|
||||||
Source: https://github.com/sahlberg/%{name}/archive/%{version}.tar.gz
|
Source: https://github.com/sahlberg/%{name}/archive/%{version}.tar.gz
|
||||||
|
|
||||||
@ -123,6 +131,19 @@ This package contains utilities of %{name} to connect to iSCSI targets
|
|||||||
%{_bindir}/iscsi-test-cu
|
%{_bindir}/iscsi-test-cu
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 8 2024 yanshuai <yanshuai01@kylinos.cn> - 1.19.0-11
|
||||||
|
- DESC: fix segmentation fault
|
||||||
|
|
||||||
|
* Wed Mar 22 2023 Wenchao Hao <haowenchao2@huawei.com> - 1.19.0-10
|
||||||
|
- DESC: backport patch to fix some memory leak issues
|
||||||
|
|
||||||
|
* Wed Jun 15 2022 Ruijun Ge <geruijun@huawei.com> - 1.19.0-9
|
||||||
|
- DESC: backport patch to solve segmentation fault problem
|
||||||
|
|
||||||
|
* Fri Jun 10 2022 Ruijun Ge <geruijun@huawei.com> - 1.19.0-8
|
||||||
|
- DESC: backport patches to solve command parameter parse problem
|
||||||
|
and dereference null pointer problem
|
||||||
|
|
||||||
* Tue Apr 12 2022 haowenchao <haowenchao@huawei.com> - 1.19.0-7
|
* Tue Apr 12 2022 haowenchao <haowenchao@huawei.com> - 1.19.0-7
|
||||||
- DESC: iscsi-inq: handle setting of debug_level correctly
|
- DESC: iscsi-inq: handle setting of debug_level correctly
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user