linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iscsi-target: Fix memory leak if iscsit_alloc_buffs() fails
@ 2012-02-24  1:28 Roland Dreier
  2012-02-25  1:17 ` Nicholas A. Bellinger
  2012-02-25  9:24 ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Roland Dreier @ 2012-02-24  1:28 UTC (permalink / raw)
  To: Nicholas A. Bellinger; +Cc: linux-scsi, target-devel

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

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

end of thread, other threads:[~2012-03-26  9:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24  1:28 [PATCH] iscsi-target: Fix memory leak if iscsit_alloc_buffs() fails Roland Dreier
2012-02-25  1:17 ` 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

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).