[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: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
Anirban Chakraborty 2010-02-04 14:17:59 -08:00 committed by James Bottomley
parent 84eb8fb42c
commit a67093d46e
3 changed files with 6 additions and 32 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -636,13 +636,15 @@ failed:
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 */