From: Roland Dreier <roland@kernel.org>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: [PATCH] iscsi-target: Fix memory leak if iscsit_alloc_buffs() fails
Date: Thu, 23 Feb 2012 17:28:43 -0800 [thread overview]
Message-ID: <1330046923-4034-1-git-send-email-roland@kernel.org> (raw)
From: Roland Dreier <roland@purestorage.com>
The function kzalloc()s sgl, but if page allocation fails, it never
frees sgl on the page_alloc_failed path.
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
drivers/target/iscsi/iscsi_target.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 9cd2837..529bf3b 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -830,6 +830,7 @@ page_alloc_failed:
__free_page(sg_page(&sgl[i]));
i--;
}
+ kfree(sgl);
kfree(cmd->t_mem_sg);
cmd->t_mem_sg = NULL;
return -ENOMEM;
--
1.7.9
next reply other threads:[~2012-02-24 1:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 1:28 Roland Dreier [this message]
2012-02-25 1:17 ` [PATCH] iscsi-target: Fix memory leak if iscsit_alloc_buffs() fails Nicholas A. Bellinger
2012-02-25 5:19 ` Roland Dreier
2012-02-25 21:28 ` Nicholas A. Bellinger
2012-02-25 9:24 ` Christoph Hellwig
2012-03-26 9:25 ` Christoph Hellwig
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=1330046923-4034-1-git-send-email-roland@kernel.org \
--to=roland@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=target-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).