From: Sapan Bhatia Date: Mon, 6 Apr 2009 15:00:50 +0000 (+0000) Subject: Missed deallocating an array in the _exit() function X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0b878cec6b2b6cd76c568a8c007730e611a77cd8;p=linux-2.6.git Missed deallocating an array in the _exit() function --- diff --git a/linux-2.6-590-GC-dcookies.patch b/linux-2.6-590-GC-dcookies.patch index c7d140938..47bcf1885 100644 --- a/linux-2.6-590-GC-dcookies.patch +++ b/linux-2.6-590-GC-dcookies.patch @@ -29,7 +29,7 @@ static inline struct dcookie_user * dcookie_register(void) --- linux-chopstix/fs/dcookies.c.orig 2009-03-05 08:46:09.000000000 -0500 -+++ linux-chopstix/fs/dcookies.c 2009-03-16 15:18:40.000000000 -0400 ++++ linux-chopstix/fs/dcookies.c 2009-04-06 11:04:30.000000000 -0400 @@ -38,14 +38,19 @@ static LIST_HEAD(dcookie_users); static DEFINE_MUTEX(dcookie_mutex); @@ -97,7 +97,7 @@ if (!dcs) return NULL; -@@ -210,9 +228,18 @@ +@@ -210,10 +228,19 @@ if (!dcookie_cache) goto out; @@ -109,15 +109,16 @@ + + dcookie_hashtable[1] = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!dcookie_hashtable[1]) -+ goto out_kmem; -+ + goto out_kmem; + + dcookie_hashtable[2] = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!dcookie_hashtable[0]) - goto out_kmem; ++ goto out_kmem; + - ++ err = 0; + /* @@ -235,7 +262,24 @@ hash_size = 1UL << hash_bits; @@ -184,7 +185,7 @@ static void dcookie_exit(void) { -@@ -269,7 +346,14 @@ +@@ -269,7 +346,21 @@ size_t i; for (i = 0; i < hash_size; ++i) { @@ -197,21 +198,30 @@ + } + + list = dcookie_hashtable[1] + i; ++ list_for_each_safe(pos, pos2, list) { ++ dcs = list_entry(pos, struct dcookie_struct, hash_list); ++ list_del(&dcs->hash_list); ++ free_dcookie(dcs); ++ } ++ ++ list = dcookie_hashtable[2] + i; list_for_each_safe(pos, pos2, list) { dcs = list_entry(pos, struct dcookie_struct, hash_list); list_del(&dcs->hash_list); -@@ -277,7 +361,8 @@ +@@ -277,7 +368,9 @@ } } - kfree(dcookie_hashtable); + kfree(dcookie_hashtable[0]); + kfree(dcookie_hashtable[1]); ++ kfree(dcookie_hashtable[2]); kmem_cache_destroy(dcookie_cache); } -@@ -327,3 +412,5 @@ +@@ -327,3 +420,5 @@ EXPORT_SYMBOL_GPL(dcookie_register); EXPORT_SYMBOL_GPL(dcookie_unregister); EXPORT_SYMBOL_GPL(get_dcookie); +EXPORT_SYMBOL_GPL(dcookie_garbage_collect); ++EXPORT_SYMBOL_GPL(dcookie_swap);