From a2828942aba8811c730c3e933486859c9cc8f68d Mon Sep 17 00:00:00 2001 From: yanshuai01 Date: Thu, 8 Aug 2024 14:53:04 +0800 Subject: [PATCH] fix segmentation fault (cherry picked from commit f372f573bf61812a8978ad164fd5f82d10b5d8d8) --- 0024-fix-segmentation-fault.patch | 27 +++++++++++++++++++++++++++ libiscsi.spec | 6 +++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 0024-fix-segmentation-fault.patch diff --git a/0024-fix-segmentation-fault.patch b/0024-fix-segmentation-fault.patch new file mode 100644 index 0000000..d23fe4c --- /dev/null +++ b/0024-fix-segmentation-fault.patch @@ -0,0 +1,27 @@ +From abedc1848cf6305f2c1f20078710755c66415d2d Mon Sep 17 00:00:00 2001 +From: folkert van heusden +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 + diff --git a/libiscsi.spec b/libiscsi.spec index 0d58965..4bb568c 100644 --- a/libiscsi.spec +++ b/libiscsi.spec @@ -1,6 +1,6 @@ Name: libiscsi Version: 1.19.0 -Release: 10 +Release: 11 Summary: Client-side library to implement the iSCSI protocol Recommends: %{name}-utils License: LGPLv2+ and GPLv2+ @@ -29,6 +29,7 @@ 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 @@ -130,6 +131,9 @@ This package contains utilities of %{name} to connect to iSCSI targets %{_bindir}/iscsi-test-cu %changelog +* Thu Aug 8 2024 yanshuai - 1.19.0-11 +- DESC: fix segmentation fault + * Wed Mar 22 2023 Wenchao Hao - 1.19.0-10 - DESC: backport patch to fix some memory leak issues -- Gitee