diff options
author | Quinn Tran <quinn.tran@cavium.com> | 2017-03-15 12:48:46 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-03-18 20:28:08 -0400 |
commit | 8f6fc8d4e7ae2347d6261d11a7eb2b247d2954d8 (patch) | |
tree | a380c60a3df9650de373c14ad878a771990c35e1 | |
parent | 8b666809e10cda9814af3e8be339d35b83909056 (diff) |
qla2xxx: Fix inadequate lock protection for ABTS.
Normally, ABTS is sent to Target Core as Task MGMT command.
In the case of error, qla2xxx needs to send response, hardware_lock
is required to prevent request queue corruption.
Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_target.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index a463bcc57902..a78c3e9bcb57 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -130,6 +130,9 @@ static void qlt_send_term_imm_notif(struct scsi_qla_host *vha, | |||
130 | static struct fc_port *qlt_create_sess(struct scsi_qla_host *vha, | 130 | static struct fc_port *qlt_create_sess(struct scsi_qla_host *vha, |
131 | fc_port_t *fcport, bool local); | 131 | fc_port_t *fcport, bool local); |
132 | void qlt_unreg_sess(struct fc_port *sess); | 132 | void qlt_unreg_sess(struct fc_port *sess); |
133 | static void qlt_24xx_handle_abts(struct scsi_qla_host *, | ||
134 | struct abts_recv_from_24xx *); | ||
135 | |||
133 | /* | 136 | /* |
134 | * Global Variables | 137 | * Global Variables |
135 | */ | 138 | */ |
@@ -389,6 +392,8 @@ static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, | |||
389 | (struct abts_recv_from_24xx *)atio; | 392 | (struct abts_recv_from_24xx *)atio; |
390 | struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha, | 393 | struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha, |
391 | entry->vp_index); | 394 | entry->vp_index); |
395 | unsigned long flags; | ||
396 | |||
392 | if (unlikely(!host)) { | 397 | if (unlikely(!host)) { |
393 | ql_dbg(ql_dbg_tgt, vha, 0xffff, | 398 | ql_dbg(ql_dbg_tgt, vha, 0xffff, |
394 | "qla_target(%d): Response pkt (ABTS_RECV_24XX) " | 399 | "qla_target(%d): Response pkt (ABTS_RECV_24XX) " |
@@ -396,9 +401,12 @@ static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, | |||
396 | vha->vp_idx, entry->vp_index); | 401 | vha->vp_idx, entry->vp_index); |
397 | break; | 402 | break; |
398 | } | 403 | } |
399 | qlt_response_pkt(host, (response_t *)atio); | 404 | if (!ha_locked) |
405 | spin_lock_irqsave(&host->hw->hardware_lock, flags); | ||
406 | qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio); | ||
407 | if (!ha_locked) | ||
408 | spin_unlock_irqrestore(&host->hw->hardware_lock, flags); | ||
400 | break; | 409 | break; |
401 | |||
402 | } | 410 | } |
403 | 411 | ||
404 | /* case PUREX_IOCB_TYPE: ql2xmvasynctoatio */ | 412 | /* case PUREX_IOCB_TYPE: ql2xmvasynctoatio */ |