[SCSI] lpfc 8.3.10: Fix Initialization issues
- Add NULL checks to the pointers for the config_async mailbox and dump_wakeup_params mailbox. - Add code to check return value of lpfc_read_sparams everywhere and handle failures appropriately. Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
Родитель
43aebfa12e
Коммит
9f1177a3f8
|
@ -2024,8 +2024,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
|
|||
int rc;
|
||||
struct fcf_record *fcf_record;
|
||||
|
||||
sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
||||
|
||||
spin_lock_irq(&phba->hbalock);
|
||||
switch (la->UlnkSpeed) {
|
||||
case LA_1GHZ_LINK:
|
||||
|
@ -2117,18 +2115,24 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
|
|||
spin_unlock_irq(&phba->hbalock);
|
||||
|
||||
lpfc_linkup(phba);
|
||||
if (sparam_mbox) {
|
||||
lpfc_read_sparam(phba, sparam_mbox, 0);
|
||||
sparam_mbox->vport = vport;
|
||||
sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
|
||||
rc = lpfc_sli_issue_mbox(phba, sparam_mbox, MBX_NOWAIT);
|
||||
if (rc == MBX_NOT_FINISHED) {
|
||||
mp = (struct lpfc_dmabuf *) sparam_mbox->context1;
|
||||
lpfc_mbuf_free(phba, mp->virt, mp->phys);
|
||||
kfree(mp);
|
||||
mempool_free(sparam_mbox, phba->mbox_mem_pool);
|
||||
goto out;
|
||||
}
|
||||
sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
||||
if (!sparam_mbox)
|
||||
goto out;
|
||||
|
||||
rc = lpfc_read_sparam(phba, sparam_mbox, 0);
|
||||
if (rc) {
|
||||
mempool_free(sparam_mbox, phba->mbox_mem_pool);
|
||||
goto out;
|
||||
}
|
||||
sparam_mbox->vport = vport;
|
||||
sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
|
||||
rc = lpfc_sli_issue_mbox(phba, sparam_mbox, MBX_NOWAIT);
|
||||
if (rc == MBX_NOT_FINISHED) {
|
||||
mp = (struct lpfc_dmabuf *) sparam_mbox->context1;
|
||||
lpfc_mbuf_free(phba, mp->virt, mp->phys);
|
||||
kfree(mp);
|
||||
mempool_free(sparam_mbox, phba->mbox_mem_pool);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(phba->hba_flag & HBA_FCOE_SUPPORT)) {
|
||||
|
|
|
@ -350,7 +350,12 @@ lpfc_config_port_post(struct lpfc_hba *phba)
|
|||
mb = &pmb->u.mb;
|
||||
|
||||
/* Get login parameters for NID. */
|
||||
lpfc_read_sparam(phba, pmb, 0);
|
||||
rc = lpfc_read_sparam(phba, pmb, 0);
|
||||
if (rc) {
|
||||
mempool_free(pmb, phba->mbox_mem_pool);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pmb->vport = vport;
|
||||
if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
|
||||
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
||||
|
@ -359,7 +364,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
|
|||
mb->mbxCommand, mb->mbxStatus);
|
||||
phba->link_state = LPFC_HBA_ERROR;
|
||||
mp = (struct lpfc_dmabuf *) pmb->context1;
|
||||
mempool_free( pmb, phba->mbox_mem_pool);
|
||||
mempool_free(pmb, phba->mbox_mem_pool);
|
||||
lpfc_mbuf_free(phba, mp->virt, mp->phys);
|
||||
kfree(mp);
|
||||
return -EIO;
|
||||
|
@ -571,6 +576,11 @@ lpfc_config_port_post(struct lpfc_hba *phba)
|
|||
}
|
||||
/* MBOX buffer will be freed in mbox compl */
|
||||
pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
||||
if (!pmb) {
|
||||
phba->link_state = LPFC_HBA_ERROR;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
lpfc_config_async(phba, pmb, LPFC_ELS_RING);
|
||||
pmb->mbox_cmpl = lpfc_config_async_cmpl;
|
||||
pmb->vport = phba->pport;
|
||||
|
@ -588,6 +598,11 @@ lpfc_config_port_post(struct lpfc_hba *phba)
|
|||
|
||||
/* Get Option rom version */
|
||||
pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
||||
if (!pmb) {
|
||||
phba->link_state = LPFC_HBA_ERROR;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
lpfc_dump_wakeup_param(phba, pmb);
|
||||
pmb->mbox_cmpl = lpfc_dump_wakeup_param_cmpl;
|
||||
pmb->vport = phba->pport;
|
||||
|
|
|
@ -4388,7 +4388,13 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
|
|||
spin_unlock_irq(&phba->hbalock);
|
||||
|
||||
/* Read the port's service parameters. */
|
||||
lpfc_read_sparam(phba, mboxq, vport->vpi);
|
||||
rc = lpfc_read_sparam(phba, mboxq, vport->vpi);
|
||||
if (rc) {
|
||||
phba->link_state = LPFC_HBA_ERROR;
|
||||
rc = -ENOMEM;
|
||||
goto out_free_vpd;
|
||||
}
|
||||
|
||||
mboxq->vport = vport;
|
||||
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
|
||||
mp = (struct lpfc_dmabuf *) mboxq->context1;
|
||||
|
|
|
@ -123,7 +123,12 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport)
|
|||
}
|
||||
mb = &pmb->u.mb;
|
||||
|
||||
lpfc_read_sparam(phba, pmb, vport->vpi);
|
||||
rc = lpfc_read_sparam(phba, pmb, vport->vpi);
|
||||
if (rc) {
|
||||
mempool_free(pmb, phba->mbox_mem_pool);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab buffer pointer and clear context1 so we can use
|
||||
* lpfc_sli_issue_box_wait
|
||||
|
|
Загрузка…
Ссылка в новой задаче