aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2006-12-02 13:34:28 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-12-03 10:29:36 -0500
commit146911500f2572fba31895aebacdc4f283208c37 (patch)
treed0f648c159f19409b7b72980ba9595600eb4761e /drivers
parenta4bc3379fbc368597024104727fdf14ced483c14 (diff)
[SCSI] lpfc 8.1.11 : Fix Memory leaks
Fix Memory leaks associated with mbox cmds READ_LA, READ_SPARAM, REG_LOGIN Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c21
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c5
4 files changed, 41 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index a47e5ab1ec4d..a5f33a0dd4e7 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -243,6 +243,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
243 struct serv_parm *sp, IOCB_t *irsp) 243 struct serv_parm *sp, IOCB_t *irsp)
244{ 244{
245 LPFC_MBOXQ_t *mbox; 245 LPFC_MBOXQ_t *mbox;
246 struct lpfc_dmabuf *mp;
246 int rc; 247 int rc;
247 248
248 spin_lock_irq(phba->host->host_lock); 249 spin_lock_irq(phba->host->host_lock);
@@ -307,10 +308,14 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
307 308
308 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); 309 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB);
309 if (rc == MBX_NOT_FINISHED) 310 if (rc == MBX_NOT_FINISHED)
310 goto fail_free_mbox; 311 goto fail_issue_reg_login;
311 312
312 return 0; 313 return 0;
313 314
315 fail_issue_reg_login:
316 mp = (struct lpfc_dmabuf *) mbox->context1;
317 lpfc_mbuf_free(phba, mp->virt, mp->phys);
318 kfree(mp);
314 fail_free_mbox: 319 fail_free_mbox:
315 mempool_free(mbox, phba->mbox_mem_pool); 320 mempool_free(mbox, phba->mbox_mem_pool);
316 fail: 321 fail:
@@ -1857,6 +1862,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1857 IOCB_t *irsp; 1862 IOCB_t *irsp;
1858 struct lpfc_nodelist *ndlp; 1863 struct lpfc_nodelist *ndlp;
1859 LPFC_MBOXQ_t *mbox = NULL; 1864 LPFC_MBOXQ_t *mbox = NULL;
1865 struct lpfc_dmabuf *mp;
1860 1866
1861 irsp = &rspiocb->iocb; 1867 irsp = &rspiocb->iocb;
1862 1868
@@ -1868,6 +1874,11 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1868 /* Check to see if link went down during discovery */ 1874 /* Check to see if link went down during discovery */
1869 if ((lpfc_els_chk_latt(phba)) || !ndlp) { 1875 if ((lpfc_els_chk_latt(phba)) || !ndlp) {
1870 if (mbox) { 1876 if (mbox) {
1877 mp = (struct lpfc_dmabuf *) mbox->context1;
1878 if (mp) {
1879 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1880 kfree(mp);
1881 }
1871 mempool_free( mbox, phba->mbox_mem_pool); 1882 mempool_free( mbox, phba->mbox_mem_pool);
1872 } 1883 }
1873 goto out; 1884 goto out;
@@ -1899,9 +1910,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1899 } 1910 }
1900 /* NOTE: we should have messages for unsuccessful 1911 /* NOTE: we should have messages for unsuccessful
1901 reglogin */ 1912 reglogin */
1902 mempool_free( mbox, phba->mbox_mem_pool);
1903 } else { 1913 } else {
1904 mempool_free( mbox, phba->mbox_mem_pool);
1905 /* Do not call NO_LIST for lpfc_els_abort'ed ELS cmds */ 1914 /* Do not call NO_LIST for lpfc_els_abort'ed ELS cmds */
1906 if (!((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && 1915 if (!((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
1907 ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || 1916 ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) ||
@@ -1913,6 +1922,12 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1913 } 1922 }
1914 } 1923 }
1915 } 1924 }
1925 mp = (struct lpfc_dmabuf *) mbox->context1;
1926 if (mp) {
1927 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1928 kfree(mp);
1929 }
1930 mempool_free(mbox, phba->mbox_mem_pool);
1916 } 1931 }
1917out: 1932out:
1918 if (ndlp) { 1933 if (ndlp) {
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 7c28184ad56d..1118b6d49fcc 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -715,6 +715,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
715{ 715{
716 int i; 716 int i;
717 LPFC_MBOXQ_t *sparam_mbox, *cfglink_mbox; 717 LPFC_MBOXQ_t *sparam_mbox, *cfglink_mbox;
718 struct lpfc_dmabuf *mp;
719 int rc;
720
718 sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 721 sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
719 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 722 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
720 723
@@ -793,16 +796,27 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
793 if (sparam_mbox) { 796 if (sparam_mbox) {
794 lpfc_read_sparam(phba, sparam_mbox); 797 lpfc_read_sparam(phba, sparam_mbox);
795 sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam; 798 sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
796 lpfc_sli_issue_mbox(phba, sparam_mbox, 799 rc = lpfc_sli_issue_mbox(phba, sparam_mbox,
797 (MBX_NOWAIT | MBX_STOP_IOCB)); 800 (MBX_NOWAIT | MBX_STOP_IOCB));
801 if (rc == MBX_NOT_FINISHED) {
802 mp = (struct lpfc_dmabuf *) sparam_mbox->context1;
803 lpfc_mbuf_free(phba, mp->virt, mp->phys);
804 kfree(mp);
805 mempool_free(sparam_mbox, phba->mbox_mem_pool);
806 if (cfglink_mbox)
807 mempool_free(cfglink_mbox, phba->mbox_mem_pool);
808 return;
809 }
798 } 810 }
799 811
800 if (cfglink_mbox) { 812 if (cfglink_mbox) {
801 phba->hba_state = LPFC_LOCAL_CFG_LINK; 813 phba->hba_state = LPFC_LOCAL_CFG_LINK;
802 lpfc_config_link(phba, cfglink_mbox); 814 lpfc_config_link(phba, cfglink_mbox);
803 cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; 815 cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
804 lpfc_sli_issue_mbox(phba, cfglink_mbox, 816 rc = lpfc_sli_issue_mbox(phba, cfglink_mbox,
805 (MBX_NOWAIT | MBX_STOP_IOCB)); 817 (MBX_NOWAIT | MBX_STOP_IOCB));
818 if (rc == MBX_NOT_FINISHED)
819 mempool_free(cfglink_mbox, phba->mbox_mem_pool);
806 } 820 }
807} 821}
808 822
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index fd734b0fe95f..6b0718573ac5 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -611,7 +611,7 @@ lpfc_handle_latt(struct lpfc_hba * phba)
611 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_la; 611 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_la;
612 rc = lpfc_sli_issue_mbox (phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)); 612 rc = lpfc_sli_issue_mbox (phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB));
613 if (rc == MBX_NOT_FINISHED) 613 if (rc == MBX_NOT_FINISHED)
614 goto lpfc_handle_latt_free_mp; 614 goto lpfc_handle_latt_free_mbuf;
615 615
616 /* Clear Link Attention in HA REG */ 616 /* Clear Link Attention in HA REG */
617 spin_lock_irq(phba->host->host_lock); 617 spin_lock_irq(phba->host->host_lock);
@@ -621,6 +621,8 @@ lpfc_handle_latt(struct lpfc_hba * phba)
621 621
622 return; 622 return;
623 623
624lpfc_handle_latt_free_mbuf:
625 lpfc_mbuf_free(phba, mp->virt, mp->phys);
624lpfc_handle_latt_free_mp: 626lpfc_handle_latt_free_mp:
625 kfree(mp); 627 kfree(mp);
626lpfc_handle_latt_free_pmb: 628lpfc_handle_latt_free_pmb:
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 958c330ecaad..0c7e731dc45a 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -739,7 +739,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
739 uint32_t evt) 739 uint32_t evt)
740{ 740{
741 struct lpfc_iocbq *cmdiocb, *rspiocb; 741 struct lpfc_iocbq *cmdiocb, *rspiocb;
742 struct lpfc_dmabuf *pcmd, *prsp; 742 struct lpfc_dmabuf *pcmd, *prsp, *mp;
743 uint32_t *lp; 743 uint32_t *lp;
744 IOCB_t *irsp; 744 IOCB_t *irsp;
745 struct serv_parm *sp; 745 struct serv_parm *sp;
@@ -829,6 +829,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
829 NLP_REGLOGIN_LIST); 829 NLP_REGLOGIN_LIST);
830 return ndlp->nlp_state; 830 return ndlp->nlp_state;
831 } 831 }
832 mp = (struct lpfc_dmabuf *)mbox->context1;
833 lpfc_mbuf_free(phba, mp->virt, mp->phys);
834 kfree(mp);
832 mempool_free(mbox, phba->mbox_mem_pool); 835 mempool_free(mbox, phba->mbox_mem_pool);
833 } else { 836 } else {
834 mempool_free(mbox, phba->mbox_mem_pool); 837 mempool_free(mbox, phba->mbox_mem_pool);