Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a96e0c7798057dd8055d0263c076fed975c10237
Commit:     a96e0c7798057dd8055d0263c076fed975c10237
Parent:     8e9d58e723e29e8b04c09bd9badd81c1d8232f5f
Author:     Mariusz Kozlowski <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 2 01:07:32 2007 +0100
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Sat Jan 6 09:05:18 2007 -0600

    [SCSI] scsi: lpfc error path fix
    
        Add kmalloc failure check and fix the loop on error path. Without the
    patch pool element at index [0] will not be freed.
    
    Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>
    Acked-by: James Smart <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/scsi/lpfc/lpfc_mem.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 066292d..ec3bbbd 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -56,6 +56,9 @@ lpfc_mem_alloc(struct lpfc_hba * phba)
 
        pool->elements = kmalloc(sizeof(struct lpfc_dmabuf) *
                                         LPFC_MBUF_POOL_SIZE, GFP_KERNEL);
+       if (!pool->elements)
+               goto fail_free_lpfc_mbuf_pool;
+
        pool->max_count = 0;
        pool->current_count = 0;
        for ( i = 0; i < LPFC_MBUF_POOL_SIZE; i++) {
@@ -82,10 +85,11 @@ lpfc_mem_alloc(struct lpfc_hba * phba)
  fail_free_mbox_pool:
        mempool_destroy(phba->mbox_mem_pool);
  fail_free_mbuf_pool:
-       while (--i)
+       while (i--)
                pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
                                                 pool->elements[i].phys);
        kfree(pool->elements);
+ fail_free_lpfc_mbuf_pool:
        pci_pool_destroy(phba->lpfc_mbuf_pool);
  fail_free_dma_buf_pool:
        pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to