lkml.org 
[lkml]   [2005]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] sparsemem fix for sparse_index_init
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-08-22 23:27    [W:0.180 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site