diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-08-22 03:05:45 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-08-22 03:45:51 -0400 |
commit | 9d86a2befceb06ee83c1a588915e6d6e0abef797 (patch) | |
tree | 2d111e3b4196d540040f7d457766af596e8c402a /drivers/target/iscsi | |
parent | ee60bddba5a5f23e39598195d944aa0eb2d455e5 (diff) |
iscsi-target: Fix ImmediateData=Yes failure regression in >= v3.10
This patch addresses a regression bug within ImmediateData=Yes failure
handling that ends up triggering an OOPs within >= v3.10 iscsi-target
code.
The problem occurs when iscsit_process_scsi_cmd() does the call to
target_put_sess_cmd(), and once again in iscsit_get_immediate_data()
that is triggered during two different cases:
- When iscsit_sequence_cmd() returns CMDSN_LOWER_THAN_EXP, for which
the descriptor state will already have been set to ISTATE_REMOVE
by iscsit_sequence_cmd(), and
- When iscsi_cmd->sense_reason is set, for which iscsit_execute_cmd()
will have already called transport_send_check_condition_and_sense()
to queue the exception response.
It changes iscsit_process_scsi_cmd() to drop the early call, and makes
iscsit_get_immediate_data() call target_put_sess_cmd() from a single
location after dumping the immediate data for the failed command.
The regression was initially introduced in commit:
commit 561bf15892375597ee59d473a704a3e634c4f311
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Wed Jul 3 03:58:58 2013 -0700
iscsi-target: Fix iscsit_sequence_cmd reject handling for iser
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index f73da43cdf9e..8fd359cb7da0 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -1086,7 +1086,6 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
1086 | if (cmd->reject_reason) | 1086 | if (cmd->reject_reason) |
1087 | return 0; | 1087 | return 0; |
1088 | 1088 | ||
1089 | target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); | ||
1090 | return 1; | 1089 | return 1; |
1091 | } | 1090 | } |
1092 | /* | 1091 | /* |
@@ -1124,14 +1123,10 @@ after_immediate_data: | |||
1124 | */ | 1123 | */ |
1125 | cmdsn_ret = iscsit_sequence_cmd(cmd->conn, cmd, | 1124 | cmdsn_ret = iscsit_sequence_cmd(cmd->conn, cmd, |
1126 | (unsigned char *)hdr, hdr->cmdsn); | 1125 | (unsigned char *)hdr, hdr->cmdsn); |
1127 | if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) { | 1126 | if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) |
1128 | return -1; | 1127 | return -1; |
1129 | } else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) { | ||
1130 | target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); | ||
1131 | return 0; | ||
1132 | } | ||
1133 | 1128 | ||
1134 | if (cmd->sense_reason) { | 1129 | if (cmd->sense_reason || cmdsn_ret == CMDSN_LOWER_THAN_EXP) { |
1135 | int rc; | 1130 | int rc; |
1136 | 1131 | ||
1137 | rc = iscsit_dump_data_payload(cmd->conn, | 1132 | rc = iscsit_dump_data_payload(cmd->conn, |