All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florin Malita <fmalita@gmail.com>
To: James.Smart@emulex.com
Cc: James.Bottomley@SteelEye.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] [scsi] lpfc: potential leak in lpfc_sli_hbqbuf_fill_hbqs
Date: Thu, 19 Jul 2007 11:50:35 -0400	[thread overview]
Message-ID: <469F884B.6010402@gmail.com> (raw)

If lpfc_hbq_alloc() fails, an hbq_buffer is leaked. Found by Coverity 
(1775).

Signed-off-by: Florin Malita <fmalita@gmail.com>
---

 drivers/scsi/lpfc/lpfc_sli.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index f4d5a6b..fe16b0c 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -622,8 +622,10 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
 			return 1;
 		hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI,
 							&hbq_buffer->dbuf.phys);
-		if (hbq_buffer->dbuf.virt == NULL)
+		if (hbq_buffer->dbuf.virt == NULL) {
+			kfree(hbq_buffer);
 			return 1;
+		}
 		hbq_buffer->tag = (i | (hbqno << 16));
 		lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer);
 		lpfc_hbq_defs[hbqno]->buffer_count++;


             reply	other threads:[~2007-07-19 15:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 15:50 Florin Malita [this message]
2007-07-19 17:44 ` [PATCH] [scsi] lpfc: potential leak in lpfc_sli_hbqbuf_fill_hbqs James Smart
2007-07-19 17:58   ` James Bottomley

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=469F884B.6010402@gmail.com \
    --to=fmalita@gmail.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=James.Smart@emulex.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.