public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [scsi] lpfc: potential leak in lpfc_sli_hbqbuf_fill_hbqs
@ 2007-07-19 15:50 Florin Malita
  2007-07-19 17:44 ` James Smart
  0 siblings, 1 reply; 3+ messages in thread
From: Florin Malita @ 2007-07-19 15:50 UTC (permalink / raw)
  To: James.Smart; +Cc: James.Bottomley, Linux Kernel Mailing List

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++;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-19 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 15:50 [PATCH] [scsi] lpfc: potential leak in lpfc_sli_hbqbuf_fill_hbqs Florin Malita
2007-07-19 17:44 ` James Smart
2007-07-19 17:58   ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox