From: "Oliver Pinter" <oliver.pntr@gmail.com>
To: "Linux Kernel" <linux-kernel@vger.kernel.org>,
stable@kernel.org, stable-commits@vger.kernel.org
Subject: Re: [2.6.22.y] {05/17} - cciss-fix_memory_leak - series for stable kernel #2
Date: Thu, 7 Feb 2008 00:07:28 +0100 [thread overview]
Message-ID: <6101e8c40802061507y109776d0o790ebefcf71baf1@mail.gmail.com> (raw)
In-Reply-To: <6101e8c40802011733g504c1cd7ubaceee5df9a51a66@mail.gmail.com>
>From f2912a1223c0917a7b4e054f18086209137891ea Mon Sep 17 00:00:00 2001
From: Jesper Juhl <jesper.juhl@gmail.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.
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@gmail.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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;
}
On 2/2/08, Oliver Pinter (Pintér Olivér) <oliver.pntr@gmail.com> wrote:
> mainline: f2912a1223c0917a7b4e054f18086209137891ea
>
> --
> Thanks,
> Oliver
>
--
Thanks,
Oliver
prev parent reply other threads:[~2008-02-06 23:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-02 1:33 Oliver Pinter (Pintér Olivér)
2008-02-06 23:07 ` Oliver Pinter [this message]
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=6101e8c40802061507y109776d0o790ebefcf71baf1@mail.gmail.com \
--to=oliver.pntr@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®