All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <James.Smart@Emulex.Com>
To: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: lpfc error path fix
Date: Wed, 03 Jan 2007 13:16:57 -0500	[thread overview]
Message-ID: <459BF319.8060602@emulex.com> (raw)
In-Reply-To: <200701020107.32742.m.kozlowski@tuxland.pl>

ACK

-- james

Mariusz Kozlowski wrote:
> Hello,
> 
> 	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 <m.kozlowski@tuxland.pl>
> 
>  drivers/scsi/lpfc/lpfc_mem.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff -upr linux-2.6.20-rc2-mm1-a/drivers/scsi/lpfc/lpfc_mem.c linux-2.6.20-rc2-mm1-b/drivers/scsi/lpfc/lpfc_mem.c
> --- linux-2.6.20-rc2-mm1-a/drivers/scsi/lpfc/lpfc_mem.c	2006-12-24 05:00:32.000000000 +0100
> +++ linux-2.6.20-rc2-mm1-b/drivers/scsi/lpfc/lpfc_mem.c	2007-01-02 00:17:25.000000000 +0100
> @@ -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);
> 
> 

      reply	other threads:[~2007-01-03 18:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02  0:07 [PATCH] scsi: lpfc error path fix Mariusz Kozlowski
2007-01-03 18:16 ` James Smart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=459BF319.8060602@emulex.com \
    --to=james.smart@emulex.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.kozlowski@tuxland.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.