[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: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by James Smart and committed by James Bottomley 5989b8d4 5af5eee7

+15 -5
+6 -1
drivers/scsi/lpfc/lpfc_attr.c
··· 3789 3789 break; 3790 3790 case MBX_SECURITY_MGMT: 3791 3791 case MBX_AUTH_PORT: 3792 - if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) 3792 + if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) { 3793 + printk(KERN_WARNING "mbox_read:Command 0x%x " 3794 + "is not permitted\n", pmb->mbxCommand); 3795 + sysfs_mbox_idle(phba); 3796 + spin_unlock_irq(&phba->hbalock); 3793 3797 return -EPERM; 3798 + } 3794 3799 break; 3795 3800 case MBX_READ_SPARM64: 3796 3801 case MBX_READ_LA:
+2 -2
drivers/scsi/lpfc/lpfc_bsg.c
··· 3142 3142 job = menlo->set_job; 3143 3143 job->dd_data = NULL; /* so timeout handler does not reply */ 3144 3144 3145 - spin_lock_irqsave(&phba->hbalock, flags); 3145 + spin_lock(&phba->hbalock); 3146 3146 cmdiocbq->iocb_flag |= LPFC_IO_WAKE; 3147 3147 if (cmdiocbq->context2 && rspiocbq) 3148 3148 memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb, 3149 3149 &rspiocbq->iocb, sizeof(IOCB_t)); 3150 - spin_unlock_irqrestore(&phba->hbalock, flags); 3150 + spin_unlock(&phba->hbalock); 3151 3151 3152 3152 bmp = menlo->bmp; 3153 3153 rspiocbq = menlo->rspiocbq;
+7 -2
drivers/scsi/lpfc/lpfc_scsi.c
··· 169 169 spin_lock_irqsave(shost->host_lock, flags); 170 170 if (!vport->stat_data_enabled || 171 171 vport->stat_data_blocked || 172 + !pnode || 172 173 !pnode->lat_data || 173 174 (phba->bucket_type == LPFC_NO_BUCKET)) { 174 175 spin_unlock_irqrestore(shost->host_lock, flags); ··· 2041 2040 struct lpfc_nodelist *pnode = lpfc_cmd->rdata->pnode; 2042 2041 unsigned long flags; 2043 2042 2043 + if (!pnode || !NLP_CHK_NODE_ACT(pnode)) 2044 + return; 2045 + 2044 2046 /* If there is queuefull or busy condition send a scsi event */ 2045 2047 if ((cmnd->result == SAM_STAT_TASK_SET_FULL) || 2046 2048 (cmnd->result == SAM_STAT_BUSY)) { ··· 3230 3226 struct lpfc_scsi_buf *lpfc_cmd; 3231 3227 struct lpfc_iocbq *iocbq; 3232 3228 struct lpfc_iocbq *iocbqrsp; 3229 + struct lpfc_nodelist *pnode = rdata->pnode; 3233 3230 int ret; 3234 3231 int status; 3235 3232 3236 - if (!rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode)) 3233 + if (!pnode || !NLP_CHK_NODE_ACT(pnode)) 3237 3234 return FAILED; 3238 3235 3239 3236 lpfc_cmd = lpfc_get_scsi_buf(phba); ··· 3261 3256 "0702 Issue %s to TGT %d LUN %d " 3262 3257 "rpi x%x nlp_flag x%x\n", 3263 3258 lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, 3264 - rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); 3259 + pnode->nlp_rpi, pnode->nlp_flag); 3265 3260 3266 3261 status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, 3267 3262 iocbq, iocbqrsp, lpfc_cmd->timeout);