Skip to content

Commit

Permalink
scsi: qla2xxx: Complain if a command is released that is owned by the…
Browse files Browse the repository at this point in the history
… firmware

The previous patch guarantees that a command is only released after the
firmware has finished processing it. Hence complain if a command is
released that is owned by the firmware.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Bart Van Assche authored and Martin K. Petersen committed Apr 29, 2019
1 parent aefed3e commit b1e261d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions drivers/scsi/qla2xxx/tcm_qla2xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd)
static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd)
{
struct qla_tgt_cmd *cmd;
unsigned long flags;

if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) {
struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd,
Expand All @@ -330,14 +329,10 @@ static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd)
}
cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd);

spin_lock_irqsave(&cmd->cmd_lock, flags);
if (cmd->cmd_sent_to_fw) {
cmd->released = 1;
spin_unlock_irqrestore(&cmd->cmd_lock, flags);
} else {
spin_unlock_irqrestore(&cmd->cmd_lock, flags);
qlt_free_cmd(cmd);
}
if (WARN_ON(cmd->cmd_sent_to_fw))
return;

qlt_free_cmd(cmd);
}

static void tcm_qla2xxx_release_session(struct kref *kref)
Expand Down

0 comments on commit b1e261d

Please sign in to comment.