diff options
author | Roland Dreier <roland@purestorage.com> | 2012-11-05 21:02:42 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-11-07 23:12:08 -0500 |
commit | 1c5c12c666fda27c7c494b34934a0a0631a48130 (patch) | |
tree | 542756ed3af922407814faaa38d49d9f1d6c218e /drivers/target/iscsi | |
parent | 64c13330a38935120501b19c97a3e6095747c7a1 (diff) |
iscsi-target: Always send a response before terminating iSCSI connection
There are some cases, for example when the initiator sends an
out-of-bounds ErrorRecoveryLevel value, where the iSCSI target
terminates the connection without sending back any error. Audit the
login path and add appropriate iscsit_tx_login_rsp() calls to make
sure this doesn't happen.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 8 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_nego.c | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 3f34ecf87b1e..7bf9ccccb588 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -127,13 +127,13 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn) | |||
127 | 127 | ||
128 | initiatorname_param = iscsi_find_param_from_key( | 128 | initiatorname_param = iscsi_find_param_from_key( |
129 | INITIATORNAME, conn->param_list); | 129 | INITIATORNAME, conn->param_list); |
130 | if (!initiatorname_param) | ||
131 | return -1; | ||
132 | |||
133 | sessiontype_param = iscsi_find_param_from_key( | 130 | sessiontype_param = iscsi_find_param_from_key( |
134 | SESSIONTYPE, conn->param_list); | 131 | SESSIONTYPE, conn->param_list); |
135 | if (!sessiontype_param) | 132 | if (!initiatorname_param || !sessiontype_param) { |
133 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, | ||
134 | ISCSI_LOGIN_STATUS_MISSING_FIELDS); | ||
136 | return -1; | 135 | return -1; |
136 | } | ||
137 | 137 | ||
138 | sessiontype = (strncmp(sessiontype_param->value, NORMAL, 6)) ? 1 : 0; | 138 | sessiontype = (strncmp(sessiontype_param->value, NORMAL, 6)) ? 1 : 0; |
139 | 139 | ||
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index e9053a04f24c..9d902aefe01a 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -620,8 +620,11 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log | |||
620 | login->req_buf, | 620 | login->req_buf, |
621 | payload_length, | 621 | payload_length, |
622 | conn); | 622 | conn); |
623 | if (ret < 0) | 623 | if (ret < 0) { |
624 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, | ||
625 | ISCSI_LOGIN_STATUS_INIT_ERR); | ||
624 | return -1; | 626 | return -1; |
627 | } | ||
625 | 628 | ||
626 | if (login->first_request) | 629 | if (login->first_request) |
627 | if (iscsi_target_check_first_request(conn, login) < 0) | 630 | if (iscsi_target_check_first_request(conn, login) < 0) |
@@ -636,8 +639,11 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log | |||
636 | login->rsp_buf, | 639 | login->rsp_buf, |
637 | &login->rsp_length, | 640 | &login->rsp_length, |
638 | conn->param_list); | 641 | conn->param_list); |
639 | if (ret < 0) | 642 | if (ret < 0) { |
643 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, | ||
644 | ISCSI_LOGIN_STATUS_INIT_ERR); | ||
640 | return -1; | 645 | return -1; |
646 | } | ||
641 | 647 | ||
642 | if (!login->auth_complete && | 648 | if (!login->auth_complete && |
643 | ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication) { | 649 | ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication) { |