2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 03:04:01 +08:00

scsi: target: tcmu: Do not queue aborted commands

If tcmu receives an already aborted command, tcmu_queue_cmd() should reject
it.

Link: https://lore.kernel.org/r/20200726153510.13077-5-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Bodo Stroesser 2020-07-26 17:35:06 +02:00 committed by Martin K. Petersen
parent a35129024e
commit c968492762

View File

@ -1103,8 +1103,8 @@ tcmu_queue_cmd(struct se_cmd *se_cmd)
struct se_device *se_dev = se_cmd->se_dev;
struct tcmu_dev *udev = TCMU_DEV(se_dev);
struct tcmu_cmd *tcmu_cmd;
sense_reason_t scsi_ret;
int ret;
sense_reason_t scsi_ret = TCM_CHECK_CONDITION_ABORT_CMD;
int ret = -1;
tcmu_cmd = tcmu_alloc_cmd(se_cmd);
if (!tcmu_cmd)
@ -1112,7 +1112,8 @@ tcmu_queue_cmd(struct se_cmd *se_cmd)
mutex_lock(&udev->cmdr_lock);
se_cmd->priv = tcmu_cmd;
ret = queue_cmd_ring(tcmu_cmd, &scsi_ret);
if (!(se_cmd->transport_state & CMD_T_ABORTED))
ret = queue_cmd_ring(tcmu_cmd, &scsi_ret);
if (ret < 0)
tcmu_free_cmd(tcmu_cmd);
mutex_unlock(&udev->cmdr_lock);