Commit a67093d4 authored by Anirban Chakraborty's avatar Anirban Chakraborty Committed by James Bottomley

[SCSI] qla2xxx: Obtain proper host structure during response-queue processing.

Original code incorrectly assumed only status-type-0
IOCBs would be queued to the response-queue, and thus all
entries would safely reference a VHA from the IOCB
'handle.'

Cc: stable@kernel.org
Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 84eb8fb4
......@@ -453,6 +453,5 @@ extern void qla24xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla25xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla25xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla24xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern struct scsi_qla_host * qla25xx_get_host(struct rsp_que *);
#endif /* _QLA_GBL_H */
......@@ -1930,7 +1930,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
spin_lock_irqsave(&ha->hardware_lock, flags);
vha = qla25xx_get_host(rsp);
vha = pci_get_drvdata(ha->pdev);
qla24xx_process_response_queue(vha, rsp);
if (!ha->flags.disable_msix_handshake) {
WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
......@@ -2280,30 +2280,3 @@ int qla25xx_request_irq(struct rsp_que *rsp)
msix->rsp = rsp;
return ret;
}
struct scsi_qla_host *
qla25xx_get_host(struct rsp_que *rsp)
{
srb_t *sp;
struct qla_hw_data *ha = rsp->hw;
struct scsi_qla_host *vha = NULL;
struct sts_entry_24xx *pkt;
struct req_que *req;
uint16_t que;
uint32_t handle;
pkt = (struct sts_entry_24xx *) rsp->ring_ptr;
que = MSW(pkt->handle);
handle = (uint32_t) LSW(pkt->handle);
req = ha->req_q_map[que];
if (handle < MAX_OUTSTANDING_COMMANDS) {
sp = req->outstanding_cmds[handle];
if (sp)
return sp->fcport->vha;
else
goto base_que;
}
base_que:
vha = pci_get_drvdata(ha->pdev);
return vha;
}
......@@ -636,13 +636,15 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
static void qla_do_work(struct work_struct *work)
{
unsigned long flags;
struct rsp_que *rsp = container_of(work, struct rsp_que, q_work);
struct scsi_qla_host *vha;
struct qla_hw_data *ha = rsp->hw;
spin_lock_irq(&rsp->hw->hardware_lock);
vha = qla25xx_get_host(rsp);
spin_lock_irqsave(&rsp->hw->hardware_lock, flags);
vha = pci_get_drvdata(ha->pdev);
qla24xx_process_response_queue(vha, rsp);
spin_unlock_irq(&rsp->hw->hardware_lock);
spin_unlock_irqrestore(&rsp->hw->hardware_lock, flags);
}
/* create response queue */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment