[PATCH] sparsemem fix for sparse_index_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>


 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux