Blame SOURCES/0001-iscsid-fix-iscsid-segfault-during-qla4xxx-login.patch

6c64be
From 71cd021b74a7094b5186a42bfe59a35e2fa66018 Mon Sep 17 00:00:00 2001
6c64be
From: Mike Christie <michaelc@cs.wisc.edu>
6c64be
Date: Wed, 5 Sep 2012 16:18:16 -0500
6c64be
Subject: iscsid: fix iscsid segfault during qla4xxx login
6c64be
6c64be
If the kernel sends multiple ISCSI_KEVENT_CONN_LOGIN_STATE
6c64be
events for the same login event iscsid will segault.
6c64be
6c64be
When we get a conn error we will set the r_stage to reopen, then when
6c64be
session_conn_process_login handles the first login event we set the r_stage
6c64be
to R_STAGE_NO_CHANGE. But then it looks like if we get a second login event
6c64be
r_stage is no_change and session_conn_process_login will run again and
6c64be
call mgmt_ipc_write_rsp on a bad qtask.
6c64be
---
6c64be
 usr/initiator.c | 5 ++++-
6c64be
 1 file changed, 4 insertions(+), 1 deletion(-)
6c64be
6c64be
diff --git a/usr/initiator.c b/usr/initiator.c
6c64be
index 79ca32c..d475358 100644
6c64be
--- a/usr/initiator.c
6c64be
+++ b/usr/initiator.c
6c64be
@@ -993,7 +993,7 @@ static void session_scan_host(struct iscsi_session *session, int hostno,
6c64be
 		exit(0);
6c64be
 	} else if (pid > 0) {
6c64be
 		reap_inc();
6c64be
-		if (qtask) {
6c64be
+		if (qtask && qtask->mgmt_ipc_fd >= 0) {
6c64be
 			close(qtask->mgmt_ipc_fd);
6c64be
 			free(qtask);
6c64be
 		}
6c64be
@@ -1618,6 +1618,9 @@ static void session_conn_process_login(void *data)
6c64be
 	if (state == ISCSI_CONN_STATE_FREE)
6c64be
 		goto failed_login;
6c64be
 
6c64be
+	if (conn->state == ISCSI_CONN_STATE_LOGGED_IN)
6c64be
+		return;
6c64be
+
6c64be
 	conn->state = ISCSI_CONN_STATE_LOGGED_IN;
6c64be
 	/*
6c64be
 	 * ok we were in_login and now we got the notification that we are
6c64be
-- 
6c64be
1.7.11.7
6c64be