52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
From 76a5ebf955702f676a5ea5f7b43bb8fb436edc40 Mon Sep 17 00:00:00 2001
|
|
From: Lee Duncan <lduncan@suse.com>
|
|
Date: Tue, 26 Jan 2021 11:48:32 -0800
|
|
Subject: [PATCH] Fix iscsiadm segfault when exiting
|
|
|
|
Commit b532ad67d495d added some cleanup code
|
|
to iscsiadm right before it exits, but it
|
|
used a list_for_each_entry() to iterate through
|
|
a list was being deleted, when it should use
|
|
list_for_each_entry_safe().
|
|
|
|
Fixes: b532ad67d495d
|
|
---
|
|
usr/iscsiadm.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
|
|
index 4249af8..41b7e6f 100644
|
|
--- a/usr/iscsiadm.c
|
|
+++ b/usr/iscsiadm.c
|
|
@@ -3582,11 +3582,11 @@ main(int argc, char **argv)
|
|
struct sigaction sa_old;
|
|
struct sigaction sa_new;
|
|
LIST_HEAD(ifaces);
|
|
- struct iface_rec *iface = NULL, *tmp;
|
|
+ struct iface_rec *iface = NULL, *tmp_iface;
|
|
struct node_rec *rec = NULL;
|
|
uint32_t host_no = MAX_HOST_NO + 1;
|
|
uint64_t index = ULLONG_MAX;
|
|
- struct user_param *param;
|
|
+ struct user_param *param, *tmp_param;
|
|
LIST_HEAD(params);
|
|
struct iscsi_context *ctx = NULL;
|
|
int librc = LIBISCSI_OK;
|
|
@@ -4070,11 +4070,11 @@ out:
|
|
free(rec);
|
|
iscsi_sessions_free(ses, se_count);
|
|
idbm_terminate();
|
|
- list_for_each_entry_safe(iface, tmp, &ifaces, list) {
|
|
+ list_for_each_entry_safe(iface, tmp_iface, &ifaces, list) {
|
|
list_del(&iface->list);
|
|
free(iface);
|
|
}
|
|
- list_for_each_entry(param, ¶ms, list) {
|
|
+ list_for_each_entry_safe(param, tmp_param, ¶ms, list) {
|
|
list_del(¶m->list);
|
|
idbm_free_user_param(param);
|
|
}
|
|
--
|
|
2.27.0
|
|
|