mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
iscsi-target: Fix ISCSI_OP_SCSI_TMFUNC handling for iser
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. Cc: [email protected] # 3.10+ Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
561bf15892
commit
186a964701
2 changed files with 18 additions and 10 deletions
|
|
@ -1200,14 +1200,12 @@ isert_put_cmd(struct isert_cmd *isert_cmd)
|
|||
{
|
||||
struct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd;
|
||||
struct isert_conn *isert_conn = isert_cmd->conn;
|
||||
struct iscsi_conn *conn;
|
||||
struct iscsi_conn *conn = isert_conn->conn;
|
||||
|
||||
pr_debug("Entering isert_put_cmd: %p\n", isert_cmd);
|
||||
|
||||
switch (cmd->iscsi_opcode) {
|
||||
case ISCSI_OP_SCSI_CMD:
|
||||
conn = isert_conn->conn;
|
||||
|
||||
spin_lock_bh(&conn->cmd_lock);
|
||||
if (!list_empty(&cmd->i_conn_node))
|
||||
list_del(&cmd->i_conn_node);
|
||||
|
|
@ -1217,16 +1215,18 @@ isert_put_cmd(struct isert_cmd *isert_cmd)
|
|||
iscsit_stop_dataout_timer(cmd);
|
||||
|
||||
isert_unmap_cmd(isert_cmd, isert_conn);
|
||||
/*
|
||||
* Fall-through
|
||||
*/
|
||||
transport_generic_free_cmd(&cmd->se_cmd, 0);
|
||||
break;
|
||||
case ISCSI_OP_SCSI_TMFUNC:
|
||||
spin_lock_bh(&conn->cmd_lock);
|
||||
if (!list_empty(&cmd->i_conn_node))
|
||||
list_del(&cmd->i_conn_node);
|
||||
spin_unlock_bh(&conn->cmd_lock);
|
||||
|
||||
transport_generic_free_cmd(&cmd->se_cmd, 0);
|
||||
break;
|
||||
case ISCSI_OP_REJECT:
|
||||
case ISCSI_OP_NOOP_OUT:
|
||||
conn = isert_conn->conn;
|
||||
|
||||
spin_lock_bh(&conn->cmd_lock);
|
||||
if (!list_empty(&cmd->i_conn_node))
|
||||
list_del(&cmd->i_conn_node);
|
||||
|
|
|
|||
Loading…
Reference in a new issue