mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bob Picco <bob.picco@hp.com>
To: akpm@osdl.org
Cc: haveblue@us.ibm.com, linux-kernel@vger.kernel.org, bob.picco@hp.com
Subject: [PATCH] sparsemem fix for sparse_index_init
Date: Mon, 22 Aug 2005 10:13:53 -0400	[thread overview]
Message-ID: <20050822141353.GN8919@localhost.localdomain> (raw)

Andrew:

After reviewing recent SPARSEMEM+EXTREME changes for -mm, I spotted a memory 
leak issue.  In sparse_index_init we must evaluate whether the root index is
allocated before allocating, acquiring the lock and then checking
whether the root is already allocated. An alternative would be in the error path
doing a free_bootmem_node but this seems the more expensive method for
boot time.

thanks,

bob

Signed-off-by: Bob Picco <bob.picco@hp.com>


 mm/sparse.c |    3 +++
 1 files changed, 3 insertions(+)

Index: linux-2.6.13-rc6-mm1/mm/sparse.c
===================================================================
--- linux-2.6.13-rc6-mm1.orig/mm/sparse.c	2005-08-19 12:47:53.000000000 -0400
+++ linux-2.6.13-rc6-mm1/mm/sparse.c	2005-08-21 13:36:57.000000000 -0400
@@ -45,6 +45,9 @@ static int sparse_index_init(unsigned lo
 	struct mem_section *section;
 	int ret = 0;
 
+	if (mem_section[root])
+		return -EEXIST;
+
 	section = sparse_index_alloc(nid);
 	/*
 	 * This lock keeps two different sections from

                 reply	other threads:[~2005-08-22 21:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050822141353.GN8919@localhost.localdomain \
    --to=bob.picco@hp.com \
    --cc=akpm@osdl.org \
    --cc=haveblue@us.ibm.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

all inboxes | Powered by JetHome®