diff options
author | James Smart <james.smart@emulex.com> | 2010-02-26 14:12:57 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-03-03 08:38:34 -0500 |
commit | 9f1177a3f8eee22427eb97e6e00b62ff0be2871f (patch) | |
tree | a004d94e7d406f791e420eec7c02c2d5bcf70587 /drivers/scsi/lpfc/lpfc_init.c | |
parent | 43aebfa12e7631124472237dc945c27af54ca646 (diff) |
[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>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index d29ac7c317d9..b64cecafa7ab 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -350,7 +350,12 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
350 | mb = &pmb->u.mb; | 350 | mb = &pmb->u.mb; |
351 | 351 | ||
352 | /* Get login parameters for NID. */ | 352 | /* Get login parameters for NID. */ |
353 | lpfc_read_sparam(phba, pmb, 0); | 353 | rc = lpfc_read_sparam(phba, pmb, 0); |
354 | if (rc) { | ||
355 | mempool_free(pmb, phba->mbox_mem_pool); | ||
356 | return -ENOMEM; | ||
357 | } | ||
358 | |||
354 | pmb->vport = vport; | 359 | pmb->vport = vport; |
355 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 360 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
356 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 361 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
@@ -359,7 +364,7 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
359 | mb->mbxCommand, mb->mbxStatus); | 364 | mb->mbxCommand, mb->mbxStatus); |
360 | phba->link_state = LPFC_HBA_ERROR; | 365 | phba->link_state = LPFC_HBA_ERROR; |
361 | mp = (struct lpfc_dmabuf *) pmb->context1; | 366 | mp = (struct lpfc_dmabuf *) pmb->context1; |
362 | mempool_free( pmb, phba->mbox_mem_pool); | 367 | mempool_free(pmb, phba->mbox_mem_pool); |
363 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 368 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
364 | kfree(mp); | 369 | kfree(mp); |
365 | return -EIO; | 370 | return -EIO; |
@@ -571,6 +576,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
571 | } | 576 | } |
572 | /* MBOX buffer will be freed in mbox compl */ | 577 | /* MBOX buffer will be freed in mbox compl */ |
573 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 578 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
579 | if (!pmb) { | ||
580 | phba->link_state = LPFC_HBA_ERROR; | ||
581 | return -ENOMEM; | ||
582 | } | ||
583 | |||
574 | lpfc_config_async(phba, pmb, LPFC_ELS_RING); | 584 | lpfc_config_async(phba, pmb, LPFC_ELS_RING); |
575 | pmb->mbox_cmpl = lpfc_config_async_cmpl; | 585 | pmb->mbox_cmpl = lpfc_config_async_cmpl; |
576 | pmb->vport = phba->pport; | 586 | pmb->vport = phba->pport; |
@@ -588,6 +598,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
588 | 598 | ||
589 | /* Get Option rom version */ | 599 | /* Get Option rom version */ |
590 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 600 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
601 | if (!pmb) { | ||
602 | phba->link_state = LPFC_HBA_ERROR; | ||
603 | return -ENOMEM; | ||
604 | } | ||
605 | |||
591 | lpfc_dump_wakeup_param(phba, pmb); | 606 | lpfc_dump_wakeup_param(phba, pmb); |
592 | pmb->mbox_cmpl = lpfc_dump_wakeup_param_cmpl; | 607 | pmb->mbox_cmpl = lpfc_dump_wakeup_param_cmpl; |
593 | pmb->vport = phba->pport; | 608 | pmb->vport = phba->pport; |