Commit 5989b8d4 authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.3.18: Fix critical errors

Fix critical errors

- Update send_scsi_event to validate pnode pointer active before copying
  the wwpn information.
- Add a message, mailbox_idle, and unlock before failing SECURITY_MGMT
  or AUTH_PORT mailbox commands
- Prevent spin_lock_irqsave from being called twice in a row.
Signed-off-by: default avatarAlex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 5af5eee7
...@@ -3789,8 +3789,13 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj, ...@@ -3789,8 +3789,13 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
break; break;
case MBX_SECURITY_MGMT: case MBX_SECURITY_MGMT:
case MBX_AUTH_PORT: case MBX_AUTH_PORT:
if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) {
printk(KERN_WARNING "mbox_read:Command 0x%x "
"is not permitted\n", pmb->mbxCommand);
sysfs_mbox_idle(phba);
spin_unlock_irq(&phba->hbalock);
return -EPERM; return -EPERM;
}
break; break;
case MBX_READ_SPARM64: case MBX_READ_SPARM64:
case MBX_READ_LA: case MBX_READ_LA:
......
...@@ -3142,12 +3142,12 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba, ...@@ -3142,12 +3142,12 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
job = menlo->set_job; job = menlo->set_job;
job->dd_data = NULL; /* so timeout handler does not reply */ job->dd_data = NULL; /* so timeout handler does not reply */
spin_lock_irqsave(&phba->hbalock, flags); spin_lock(&phba->hbalock);
cmdiocbq->iocb_flag |= LPFC_IO_WAKE; cmdiocbq->iocb_flag |= LPFC_IO_WAKE;
if (cmdiocbq->context2 && rspiocbq) if (cmdiocbq->context2 && rspiocbq)
memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb, memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb,
&rspiocbq->iocb, sizeof(IOCB_t)); &rspiocbq->iocb, sizeof(IOCB_t));
spin_unlock_irqrestore(&phba->hbalock, flags); spin_unlock(&phba->hbalock);
bmp = menlo->bmp; bmp = menlo->bmp;
rspiocbq = menlo->rspiocbq; rspiocbq = menlo->rspiocbq;
......
...@@ -169,6 +169,7 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) ...@@ -169,6 +169,7 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
if (!vport->stat_data_enabled || if (!vport->stat_data_enabled ||
vport->stat_data_blocked || vport->stat_data_blocked ||
!pnode ||
!pnode->lat_data || !pnode->lat_data ||
(phba->bucket_type == LPFC_NO_BUCKET)) { (phba->bucket_type == LPFC_NO_BUCKET)) {
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
...@@ -2040,6 +2041,9 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, ...@@ -2040,6 +2041,9 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport,
struct lpfc_nodelist *pnode = lpfc_cmd->rdata->pnode; struct lpfc_nodelist *pnode = lpfc_cmd->rdata->pnode;
unsigned long flags; unsigned long flags;
if (!pnode || !NLP_CHK_NODE_ACT(pnode))
return;
/* If there is queuefull or busy condition send a scsi event */ /* If there is queuefull or busy condition send a scsi event */
if ((cmnd->result == SAM_STAT_TASK_SET_FULL) || if ((cmnd->result == SAM_STAT_TASK_SET_FULL) ||
(cmnd->result == SAM_STAT_BUSY)) { (cmnd->result == SAM_STAT_BUSY)) {
...@@ -3226,10 +3230,11 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, ...@@ -3226,10 +3230,11 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
struct lpfc_scsi_buf *lpfc_cmd; struct lpfc_scsi_buf *lpfc_cmd;
struct lpfc_iocbq *iocbq; struct lpfc_iocbq *iocbq;
struct lpfc_iocbq *iocbqrsp; struct lpfc_iocbq *iocbqrsp;
struct lpfc_nodelist *pnode = rdata->pnode;
int ret; int ret;
int status; int status;
if (!rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode)) if (!pnode || !NLP_CHK_NODE_ACT(pnode))
return FAILED; return FAILED;
lpfc_cmd = lpfc_get_scsi_buf(phba); lpfc_cmd = lpfc_get_scsi_buf(phba);
...@@ -3256,7 +3261,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, ...@@ -3256,7 +3261,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
"0702 Issue %s to TGT %d LUN %d " "0702 Issue %s to TGT %d LUN %d "
"rpi x%x nlp_flag x%x\n", "rpi x%x nlp_flag x%x\n",
lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id,
rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); pnode->nlp_rpi, pnode->nlp_flag);
status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING,
iocbq, iocbqrsp, lpfc_cmd->timeout); iocbq, iocbqrsp, lpfc_cmd->timeout);
......
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