diff options
author | James Smart <james.smart@emulex.com> | 2012-08-14 14:26:35 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-09-14 12:59:25 -0400 |
commit | cdcc2343fec00b3b364c0518ef2bb91587319407 (patch) | |
tree | a02d574826fbaebb110799e4bda3c825f7ee44a1 /drivers/scsi | |
parent | 92e3af663ab6ef7db888f3d3ffb7568fab870127 (diff) |
[SCSI] lpfc 8.3.34: Fixed leaking memory from pci dma pool
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 25 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 2 |
2 files changed, 17 insertions, 10 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index eba4b0262bbe..e9845d2ecf10 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -3509,7 +3509,7 @@ lpfc_create_static_vport(struct lpfc_hba *phba) | |||
3509 | LPFC_MBOXQ_t *pmb = NULL; | 3509 | LPFC_MBOXQ_t *pmb = NULL; |
3510 | MAILBOX_t *mb; | 3510 | MAILBOX_t *mb; |
3511 | struct static_vport_info *vport_info; | 3511 | struct static_vport_info *vport_info; |
3512 | int rc = 0, i; | 3512 | int mbx_wait_rc = 0, i; |
3513 | struct fc_vport_identifiers vport_id; | 3513 | struct fc_vport_identifiers vport_id; |
3514 | struct fc_vport *new_fc_vport; | 3514 | struct fc_vport *new_fc_vport; |
3515 | struct Scsi_Host *shost; | 3515 | struct Scsi_Host *shost; |
@@ -3526,7 +3526,7 @@ lpfc_create_static_vport(struct lpfc_hba *phba) | |||
3526 | " allocate mailbox memory\n"); | 3526 | " allocate mailbox memory\n"); |
3527 | return; | 3527 | return; |
3528 | } | 3528 | } |
3529 | 3529 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); | |
3530 | mb = &pmb->u.mb; | 3530 | mb = &pmb->u.mb; |
3531 | 3531 | ||
3532 | vport_info = kzalloc(sizeof(struct static_vport_info), GFP_KERNEL); | 3532 | vport_info = kzalloc(sizeof(struct static_vport_info), GFP_KERNEL); |
@@ -3540,24 +3540,31 @@ lpfc_create_static_vport(struct lpfc_hba *phba) | |||
3540 | 3540 | ||
3541 | vport_buff = (uint8_t *) vport_info; | 3541 | vport_buff = (uint8_t *) vport_info; |
3542 | do { | 3542 | do { |
3543 | /* free dma buffer from previous round */ | ||
3544 | if (pmb->context1) { | ||
3545 | mp = (struct lpfc_dmabuf *)pmb->context1; | ||
3546 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
3547 | kfree(mp); | ||
3548 | } | ||
3543 | if (lpfc_dump_static_vport(phba, pmb, offset)) | 3549 | if (lpfc_dump_static_vport(phba, pmb, offset)) |
3544 | goto out; | 3550 | goto out; |
3545 | 3551 | ||
3546 | pmb->vport = phba->pport; | 3552 | pmb->vport = phba->pport; |
3547 | rc = lpfc_sli_issue_mbox_wait(phba, pmb, LPFC_MBOX_TMO); | 3553 | mbx_wait_rc = lpfc_sli_issue_mbox_wait(phba, pmb, |
3554 | LPFC_MBOX_TMO); | ||
3548 | 3555 | ||
3549 | if ((rc != MBX_SUCCESS) || mb->mbxStatus) { | 3556 | if ((mbx_wait_rc != MBX_SUCCESS) || mb->mbxStatus) { |
3550 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 3557 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
3551 | "0544 lpfc_create_static_vport failed to" | 3558 | "0544 lpfc_create_static_vport failed to" |
3552 | " issue dump mailbox command ret 0x%x " | 3559 | " issue dump mailbox command ret 0x%x " |
3553 | "status 0x%x\n", | 3560 | "status 0x%x\n", |
3554 | rc, mb->mbxStatus); | 3561 | mbx_wait_rc, mb->mbxStatus); |
3555 | goto out; | 3562 | goto out; |
3556 | } | 3563 | } |
3557 | 3564 | ||
3558 | if (phba->sli_rev == LPFC_SLI_REV4) { | 3565 | if (phba->sli_rev == LPFC_SLI_REV4) { |
3559 | byte_count = pmb->u.mqe.un.mb_words[5]; | 3566 | byte_count = pmb->u.mqe.un.mb_words[5]; |
3560 | mp = (struct lpfc_dmabuf *) pmb->context2; | 3567 | mp = (struct lpfc_dmabuf *)pmb->context1; |
3561 | if (byte_count > sizeof(struct static_vport_info) - | 3568 | if (byte_count > sizeof(struct static_vport_info) - |
3562 | offset) | 3569 | offset) |
3563 | byte_count = sizeof(struct static_vport_info) | 3570 | byte_count = sizeof(struct static_vport_info) |
@@ -3621,9 +3628,9 @@ lpfc_create_static_vport(struct lpfc_hba *phba) | |||
3621 | 3628 | ||
3622 | out: | 3629 | out: |
3623 | kfree(vport_info); | 3630 | kfree(vport_info); |
3624 | if (rc != MBX_TIMEOUT) { | 3631 | if (mbx_wait_rc != MBX_TIMEOUT) { |
3625 | if (pmb->context2) { | 3632 | if (pmb->context1) { |
3626 | mp = (struct lpfc_dmabuf *) pmb->context2; | 3633 | mp = (struct lpfc_dmabuf *)pmb->context1; |
3627 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 3634 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
3628 | kfree(mp); | 3635 | kfree(mp); |
3629 | } | 3636 | } |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 721ce1f430c7..efc9cd9def8b 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -92,7 +92,7 @@ lpfc_dump_static_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, | |||
92 | memset(mp->virt, 0, LPFC_BPL_SIZE); | 92 | memset(mp->virt, 0, LPFC_BPL_SIZE); |
93 | INIT_LIST_HEAD(&mp->list); | 93 | INIT_LIST_HEAD(&mp->list); |
94 | /* save address for completion */ | 94 | /* save address for completion */ |
95 | pmb->context2 = (uint8_t *) mp; | 95 | pmb->context1 = (uint8_t *)mp; |
96 | mb->un.varWords[3] = putPaddrLow(mp->phys); | 96 | mb->un.varWords[3] = putPaddrLow(mp->phys); |
97 | mb->un.varWords[4] = putPaddrHigh(mp->phys); | 97 | mb->un.varWords[4] = putPaddrHigh(mp->phys); |
98 | mb->un.varDmp.sli4_length = sizeof(struct static_vport_info); | 98 | mb->un.varDmp.sli4_length = sizeof(struct static_vport_info); |