[netfilter-cvslog] r4259 - in trunk/patch-o-matic-ng/patchlets/set: linux/include/linux/netfilter_ipv4 linux/net/ipv4/netfilter linux-2.6/include/linux/netfilter_ipv4 linux-2.6/net/ipv4/netfilter

kadlec at netfilter.org kadlec at netfilter.org
Wed Sep 14 12:33:57 CEST 2005


Author: kadlec at netfilter.org
Date: 2005-09-14 12:33:55 +0200 (Wed, 14 Sep 2005)
New Revision: 4259

Modified:
   trunk/patch-o-matic-ng/patchlets/set/linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h
   trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_iphash.c
   trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c
   trunk/patch-o-matic-ng/patchlets/set/linux/include/linux/netfilter_ipv4/ip_set_malloc.h
   trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_iphash.c
   trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_nethash.c
Log:
Memory allocation bug in iphash/nethash fixed, lockhelp.h
dependency removed.


Modified: trunk/patch-o-matic-ng/patchlets/set/linux/include/linux/netfilter_ipv4/ip_set_malloc.h
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux/include/linux/netfilter_ipv4/ip_set_malloc.h	2005-09-13 13:21:31 UTC (rev 4258)
+++ trunk/patch-o-matic-ng/patchlets/set/linux/include/linux/netfilter_ipv4/ip_set_malloc.h	2005-09-14 10:33:55 UTC (rev 4259)
@@ -6,6 +6,14 @@
 /* Memory allocation and deallocation */
 static size_t max_malloc_size = 131072;		/* Guaranteed: slab.c */
 
+static inline void * ip_set_malloc_atomic(size_t bytes)
+{
+	if (bytes > max_malloc_size)
+		return __vmalloc(bytes, GFP_ATOMIC, PAGE_KERNEL);
+	else
+		return kmalloc(bytes, GFP_ATOMIC);
+}
+
 static inline void * ip_set_malloc(size_t bytes)
 {
 	if (bytes > max_malloc_size)

Modified: trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_iphash.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_iphash.c	2005-09-13 13:21:31 UTC (rev 4258)
+++ trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_iphash.c	2005-09-14 10:33:55 UTC (rev 4259)
@@ -177,7 +177,7 @@
 	tmp.hashsize = hashsize;
 	
 	newbytes = hashsize * sizeof(ip_set_ip_t);
-	tmp.members = ip_set_malloc(newbytes);
+	tmp.members = ip_set_malloc_atomic(newbytes);
 	if (!tmp.members) {
 		DP("out of memory for %d bytes", newbytes);
 		return -ENOMEM;

Modified: trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_nethash.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_nethash.c	2005-09-13 13:21:31 UTC (rev 4258)
+++ trunk/patch-o-matic-ng/patchlets/set/linux/net/ipv4/netfilter/ip_set_nethash.c	2005-09-14 10:33:55 UTC (rev 4259)
@@ -241,7 +241,7 @@
 	tmp.hashsize = hashsize;
 	
 	newbytes = hashsize * sizeof(ip_set_ip_t);
-	tmp.members = ip_set_malloc(newbytes);
+	tmp.members = ip_set_malloc_atomic(newbytes);
 	if (!tmp.members) {
 		DP("out of memory for %d bytes", newbytes);
 		return -ENOMEM;

Modified: trunk/patch-o-matic-ng/patchlets/set/linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h	2005-09-13 13:21:31 UTC (rev 4258)
+++ trunk/patch-o-matic-ng/patchlets/set/linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h	2005-09-14 10:33:55 UTC (rev 4259)
@@ -13,6 +13,14 @@
 #undef CACHE
 }
 
+static inline void * ip_set_malloc_atomic(size_t bytes)
+{
+	if (bytes > max_malloc_size)
+		return __vmalloc(bytes, GFP_ATOMIC, PAGE_KERNEL);
+	else
+		return kmalloc(bytes, GFP_ATOMIC);
+}
+
 static inline void * ip_set_malloc(size_t bytes)
 {
 	if (bytes > max_malloc_size)

Modified: trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_iphash.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_iphash.c	2005-09-13 13:21:31 UTC (rev 4258)
+++ trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_iphash.c	2005-09-14 10:33:55 UTC (rev 4259)
@@ -176,7 +176,7 @@
 	tmp.hashsize = hashsize;
 	
 	newbytes = hashsize * sizeof(ip_set_ip_t);
-	tmp.members = ip_set_malloc(newbytes);
+	tmp.members = ip_set_malloc_atomic(newbytes);
 	if (!tmp.members) {
 		DP("out of memory for %d bytes", newbytes);
 		return -ENOMEM;

Modified: trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c	2005-09-13 13:21:31 UTC (rev 4258)
+++ trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c	2005-09-14 10:33:55 UTC (rev 4259)
@@ -240,7 +240,7 @@
 	tmp.hashsize = hashsize;
 	
 	newbytes = hashsize * sizeof(ip_set_ip_t);
-	tmp.members = ip_set_malloc(newbytes);
+	tmp.members = ip_set_malloc_atomic(newbytes);
 	if (!tmp.members) {
 		DP("out of memory for %d bytes", newbytes);
 		return -ENOMEM;




More information about the netfilter-cvslog mailing list