[PATCH] add allocation flag to nf_conntrack_alloc ctnetlink does not need to allocate the conntrack entries with GFP_ATOMIC as its code is executed in user context. Signed-off-by: Pablo Neira Ayuso Index: net-2.6/include/net/netfilter/nf_conntrack.h =================================================================== --- net-2.6.orig/include/net/netfilter/nf_conntrack.h 2008-06-12 14:43:41.000000000 +0200 +++ net-2.6/include/net/netfilter/nf_conntrack.h 2008-06-12 14:43:59.000000000 +0200 @@ -239,7 +239,8 @@ extern void nf_conntrack_free(struct nf_conn *ct); extern struct nf_conn * nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, - const struct nf_conntrack_tuple *repl); + const struct nf_conntrack_tuple *repl, + gfp_t allocation); /* It's confirmed if it is, or has been in the hash table. */ static inline int nf_ct_is_confirmed(struct nf_conn *ct) Index: net-2.6/net/netfilter/nf_conntrack_core.c =================================================================== --- net-2.6.orig/net/netfilter/nf_conntrack_core.c 2008-06-12 14:42:05.000000000 +0200 +++ net-2.6/net/netfilter/nf_conntrack_core.c 2008-06-12 14:45:31.000000000 +0200 @@ -466,7 +466,8 @@ } struct nf_conn *nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, - const struct nf_conntrack_tuple *repl) + const struct nf_conntrack_tuple *repl, + gfp_t allocation) { struct nf_conn *ct = NULL; @@ -491,7 +492,7 @@ } } - ct = kmem_cache_zalloc(nf_conntrack_cachep, GFP_ATOMIC); + ct = kmem_cache_zalloc(nf_conntrack_cachep, allocation); if (ct == NULL) { pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n"); atomic_dec(&nf_conntrack_count); @@ -543,7 +544,7 @@ return NULL; } - ct = nf_conntrack_alloc(tuple, &repl_tuple); + ct = nf_conntrack_alloc(tuple, &repl_tuple, GFP_ATOMIC); if (ct == NULL || IS_ERR(ct)) { pr_debug("Can't allocate conntrack.\n"); return (struct nf_conntrack_tuple_hash *)ct; Index: net-2.6/net/netfilter/nf_conntrack_netlink.c =================================================================== --- net-2.6.orig/net/netfilter/nf_conntrack_netlink.c 2008-06-12 14:45:42.000000000 +0200 +++ net-2.6/net/netfilter/nf_conntrack_netlink.c 2008-06-12 14:45:50.000000000 +0200 @@ -1130,7 +1130,7 @@ struct nf_conn_help *help; struct nf_conntrack_helper *helper; - ct = nf_conntrack_alloc(otuple, rtuple); + ct = nf_conntrack_alloc(otuple, rtuple, GFP_KERNEL); if (ct == NULL || IS_ERR(ct)) return -ENOMEM;