mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparsemem fix for sparse_index_init
@ 2005-08-22 14:13 Bob Picco
  0 siblings, 0 replies; only message in thread
From: Bob Picco @ 2005-08-22 14:13 UTC (permalink / raw)
  To: akpm; +Cc: haveblue, linux-kernel, bob.picco

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-22 21:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 14:13 [PATCH] sparsemem fix for sparse_index_init Bob Picco

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®