[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6101e8c40802071203r5d56f6d6m330a4d7a15e4642b@mail.gmail.com>
Date: Thu, 7 Feb 2008 21:03:11 +0100
From: "Oliver Pinter" <oliver.pntr@...il.com>
To: "Linux Kernel" <linux-kernel@...r.kernel.org>, stable@...nel.org,
stable-commits@...r.kernel.org
Subject: [2.6.22.y] {01/14} - cciss: fix memory leak - on top of 2.6.22.17
aka: cciss-fix_memory_leak.patch
>From f2912a1223c0917a7b4e054f18086209137891ea Mon Sep 17 00:00:00 2001
From: Jesper Juhl <jesper.juhl@...il.com>
Date: Tue, 31 Jul 2007 00:39:39 -0700
Subject: [PATCH] cciss: fix memory leak
There's a memory leak in the cciss driver.
mainline: f2912a1223c0917a7b4e054f18086209137891ea
in alloc_cciss_hba() we may leak sizeof(ctlr_info_t) bytes if a
call to alloc_disk(1 << NWD_SHIFT) fails.
This patch should fix the issue.
Spotted by the Coverity checker.
Signed-off-by: Jesper Juhl <jesper.juhl@...il.com>
Acked-by: Mike Miller <mike.miller@...com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Oliver Pinter <oliver.pntr@...il.com>
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1be82d5..a11b2bd 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3227,12 +3227,15 @@ static int alloc_cciss_hba(void)
for (i = 0; i < MAX_CTLR; i++) {
if (!hba[i]) {
ctlr_info_t *p;
+
p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
if (!p)
goto Enomem;
p->gendisk[0] = alloc_disk(1 << NWD_SHIFT);
- if (!p->gendisk[0])
+ if (!p->gendisk[0]) {
+ kfree(p);
goto Enomem;
+ }
hba[i] = p;
return i;
}
--
Thanks,
Oliver
--
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