From: Bob Picco 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. Signed-off-by: Bob Picco Cc: Dave Hansen Cc: Andy Whitcroft Signed-off-by: Andrew Morton --- mm/sparse.c | 3 +++ 1 files changed, 3 insertions(+) diff -puN mm/sparse.c~sparsemem-extreme-hotplug-preparation-fix mm/sparse.c --- devel/mm/sparse.c~sparsemem-extreme-hotplug-preparation-fix 2005-08-22 15:48:46.000000000 -0700 +++ devel-akpm/mm/sparse.c 2005-08-22 15:48:46.000000000 -0700 @@ -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 _