From: Andrew Morton <akpm@osdl.org>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: linux-kernel@vger.kernel.org, jesper.juhl@gmail.com,
Christoph Lameter <clameter@engr.sgi.com>
Subject: Re: [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist()
Date: Sun, 12 Mar 2006 14:41:29 -0800 [thread overview]
Message-ID: <20060312144129.0b5c227d.akpm@osdl.org> (raw)
In-Reply-To: <200603121428.08226.jesper.juhl@gmail.com>
Jesper Juhl <jesper.juhl@gmail.com> wrote:
>
>
> The Coverity checker found that we may leak memory in
> mm/slab.c::alloc_kmemlist()
> This should fix the leak and coverity bug #589
>
>
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> ---
>
> mm/slab.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletion(-)
>
> --- linux-2.6.16-rc6-orig/mm/slab.c 2006-03-12 14:19:17.000000000 +0100
> +++ linux-2.6.16-rc6/mm/slab.c 2006-03-12 14:22:40.000000000 +0100
> @@ -3366,8 +3366,10 @@ static int alloc_kmemlist(struct kmem_ca
> continue;
> }
> if (!(l3 = kmalloc_node(sizeof(struct kmem_list3),
> - GFP_KERNEL, node)))
> + GFP_KERNEL, node))) {
> + kfree(new);
> goto fail;
> + }
>
> kmem_list3_init(l3);
> l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
It's more complicated than that. We can also leak new_alien. And if any
allocation in that for_each_online_node() loop fails I guess we need to
back out all the allocations we've done thus far, which means another loop.
ug.
Patches against rc6-mm1 would be preferred please, that code's changed
quite a bit.
next prev parent reply other threads:[~2006-03-12 22:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-12 13:28 [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist() Jesper Juhl
2006-03-12 22:41 ` Andrew Morton [this message]
2006-03-13 7:34 ` Jesper Juhl
2006-03-13 21:33 ` Jesper Juhl
2006-03-13 21:46 ` Christoph Lameter
2006-03-13 21:59 ` Jesper Juhl
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=20060312144129.0b5c227d.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=clameter@engr.sgi.com \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@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