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