From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> This patch changes qla24xx_handle_srr() and qla2xxx_handle_srr() to return NOTIFY_ACK_SRR_FLAGS_REJECT for SRR_IU_DATA_IN and SRR_IU_DATA_OUT with non GOOD SCSI status. This fixes a bug with SRR_IU_DATA_IN processing where a failed FCP READ MODE_SENSE is returned with a CHECK_CONDITION status and triggering an OOPs within qla_tgt_pci_map_calc_cnt() Reported-by: Roland Dreier <roland@xxxxxxxxxxxxxxx> Cc: Andrew Vasquez <andrew.vasquez@xxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxxxxxxxx> --- drivers/scsi/qla2xxx/qla_target.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 7c498cb..f0b10ad 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -3635,6 +3635,11 @@ static void qla24xx_handle_srr(struct scsi_qla_host *vha, struct srr_ctio *sctio dump_stack(); goto out_reject; } + if (se_cmd->scsi_status != 0) { + DEBUG21(qla_printk(KERN_ERR, vha->ha, "Rejecting SRR_IU_DATA_IN" + " with non GOOD scsi_status\n")); + goto out_reject; + } cmd->bufflen = se_cmd->data_length; if (qla_tgt_has_data(cmd)) { @@ -3663,6 +3668,11 @@ static void qla24xx_handle_srr(struct scsi_qla_host *vha, struct srr_ctio *sctio dump_stack(); goto out_reject; } + if (se_cmd->scsi_status != 0) { + DEBUG21(qla_printk(KERN_ERR, vha->ha, "Rejecting SRR_IU_DATA_OUT" + " with non GOOD scsi_status\n")); + goto out_reject; + } cmd->bufflen = se_cmd->data_length; if (qla_tgt_has_data(cmd)) { @@ -3728,7 +3738,19 @@ static void qla2xxx_handle_srr(struct scsi_qla_host *vha, struct srr_ctio *sctio __qla2xxx_xmit_response(cmd, QLA_TGT_XMIT_STATUS, se_cmd->scsi_status); break; case SRR_IU_DATA_IN: + if (!cmd->sg || !cmd->sg_cnt) { + printk(KERN_ERR "Unable to process SRR_IU_DATA_IN due to" + " missing cmd->sg, state: %d\n", cmd->state); + dump_stack(); + goto out_reject; + } + if (se_cmd->scsi_status != 0) { + DEBUG21(qla_printk(KERN_ERR, vha->ha, "Rejecting SRR_IU_DATA_IN" + " with non GOOD scsi_status\n")); + goto out_reject; + } cmd->bufflen = se_cmd->data_length; + if (qla_tgt_has_data(cmd)) { uint32_t offset; int xmit_type; @@ -3754,6 +3776,11 @@ static void qla2xxx_handle_srr(struct scsi_qla_host *vha, struct srr_ctio *sctio " missing cmd->sg\n"); goto out_reject; } + if (se_cmd->scsi_status != 0) { + DEBUG21(qla_printk(KERN_ERR, vha->ha, "Rejecting SRR_IU_DATA_OUT" + " with non GOOD scsi_status\n")); + goto out_reject; + } cmd->bufflen = se_cmd->data_length; if (qla_tgt_has_data(cmd)) { -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html