diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-07-03 06:11:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-04 04:50:34 -0400 |
commit | c6ccbb9b6e24e35d71fd8706dfc5a8eab07f6937 (patch) | |
tree | 8ca00d0d33adf2cb6e683fa179d1473b5524bb2d /drivers/infiniband/ulp | |
parent | d9e507c05ca19ad2ec166577edd8b47e17c8961e (diff) |
iscsi-target: Fix ISCSI_OP_SCSI_TMFUNC handling for iser
commit 186a9647019587b3784694894c4d136fd00cfd7b upstream.
This patch adds target_get_sess_cmd reference counting for
iscsit_handle_task_mgt_cmd(), and adds a target_put_sess_cmd()
for the failure case.
It also fixes a bug where ISCSI_OP_SCSI_TMFUNC type commands
where leaking iscsi_cmd->i_conn_node and eventually triggering
an OOPs during struct isert_conn shutdown.
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 6b20a9d09cbb..bfc21798bd5e 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -1202,14 +1202,12 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1202 | { | 1202 | { |
1203 | struct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd; | 1203 | struct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd; |
1204 | struct isert_conn *isert_conn = isert_cmd->conn; | 1204 | struct isert_conn *isert_conn = isert_cmd->conn; |
1205 | struct iscsi_conn *conn; | 1205 | struct iscsi_conn *conn = isert_conn->conn; |
1206 | 1206 | ||
1207 | pr_debug("Entering isert_put_cmd: %p\n", isert_cmd); | 1207 | pr_debug("Entering isert_put_cmd: %p\n", isert_cmd); |
1208 | 1208 | ||
1209 | switch (cmd->iscsi_opcode) { | 1209 | switch (cmd->iscsi_opcode) { |
1210 | case ISCSI_OP_SCSI_CMD: | 1210 | case ISCSI_OP_SCSI_CMD: |
1211 | conn = isert_conn->conn; | ||
1212 | |||
1213 | spin_lock_bh(&conn->cmd_lock); | 1211 | spin_lock_bh(&conn->cmd_lock); |
1214 | if (!list_empty(&cmd->i_conn_node)) | 1212 | if (!list_empty(&cmd->i_conn_node)) |
1215 | list_del(&cmd->i_conn_node); | 1213 | list_del(&cmd->i_conn_node); |
@@ -1219,16 +1217,18 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1219 | iscsit_stop_dataout_timer(cmd); | 1217 | iscsit_stop_dataout_timer(cmd); |
1220 | 1218 | ||
1221 | isert_unmap_cmd(isert_cmd, isert_conn); | 1219 | isert_unmap_cmd(isert_cmd, isert_conn); |
1222 | /* | 1220 | transport_generic_free_cmd(&cmd->se_cmd, 0); |
1223 | * Fall-through | 1221 | break; |
1224 | */ | ||
1225 | case ISCSI_OP_SCSI_TMFUNC: | 1222 | case ISCSI_OP_SCSI_TMFUNC: |
1223 | spin_lock_bh(&conn->cmd_lock); | ||
1224 | if (!list_empty(&cmd->i_conn_node)) | ||
1225 | list_del(&cmd->i_conn_node); | ||
1226 | spin_unlock_bh(&conn->cmd_lock); | ||
1227 | |||
1226 | transport_generic_free_cmd(&cmd->se_cmd, 0); | 1228 | transport_generic_free_cmd(&cmd->se_cmd, 0); |
1227 | break; | 1229 | break; |
1228 | case ISCSI_OP_REJECT: | 1230 | case ISCSI_OP_REJECT: |
1229 | case ISCSI_OP_NOOP_OUT: | 1231 | case ISCSI_OP_NOOP_OUT: |
1230 | conn = isert_conn->conn; | ||
1231 | |||
1232 | spin_lock_bh(&conn->cmd_lock); | 1232 | spin_lock_bh(&conn->cmd_lock); |
1233 | if (!list_empty(&cmd->i_conn_node)) | 1233 | if (!list_empty(&cmd->i_conn_node)) |
1234 | list_del(&cmd->i_conn_node); | 1234 | list_del(&cmd->i_conn_node); |