[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1106272351520.30245@swampdragon.chaosbits.net>
Date: Mon, 27 Jun 2011 23:54:48 +0200 (CEST)
From: Jesper Juhl <jj@...osbits.net>
To: "Nicholas A. Bellinger" <nab@...ux-iscsi.org>
cc: James Bottomley <jbottomley@...allels.com>,
Dan Carpenter <error27@...il.com>,
Christoph Hellwig <hch@....de>, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH][Resend] SCSI, target, loopback: Fix memory leak in
tcm_loop_make_scsi_hba()
There is a memory leak in tcm_loop_make_scsi_hba().
If all the strstr() calls return NULL and we end up at
return ERR_PTR(-EINVAL);
then we'll be leaking the memory previously allocated to tl_hba as
that variable goes out of scope.
This patch should fix the leak.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
drivers/target/loopback/tcm_loop.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
Compile tested only.
Last submitted April 07, 2011
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 70c2e7f..aa3bb70 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -1321,7 +1321,8 @@ struct se_wwn *tcm_loop_make_scsi_hba(
printk(KERN_ERR "Unable to locate prefix for emulated Target Port:"
" %s\n", name);
- return ERR_PTR(-EINVAL);
+ ret = -EINVAL;
+ goto out;
check_len:
if (strlen(name) >= TL_WWN_ADDR_LEN) {
--
1.7.5.2
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists