···202202 * Allocate a hashtable of hlist_head (if nulls == 0),203203 * or hlist_nulls_head (if nulls == 1)204204 */205205-extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls);205205+extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);206206207207-extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);207207+extern void nf_ct_free_hashtable(void *hash, unsigned int size);208208209209extern struct nf_conntrack_tuple_hash *210210__nf_conntrack_find(struct net *net, u16 zone,
-2
include/net/netns/conntrack.h
···2828 struct ctl_table_header *acct_sysctl_header;2929 struct ctl_table_header *event_sysctl_header;3030#endif3131- int hash_vmalloc;3232- int expect_vmalloc;3331 char *slabname;3432};3533#endif
-1
include/net/netns/ipv4.h
···4343 struct xt_table *nat_table;4444 struct hlist_head *nat_bysource;4545 unsigned int nat_htable_size;4646- int nat_vmalloced;4746#endif48474948 int sysctl_icmp_echo_ignore_all;
+2-4
net/ipv4/netfilter/nf_nat_core.c
···682682{683683 /* Leave them the same for the moment. */684684 net->ipv4.nat_htable_size = net->ct.htable_size;685685- net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&net->ipv4.nat_htable_size,686686- &net->ipv4.nat_vmalloced, 0);685685+ net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&net->ipv4.nat_htable_size, 0);687686 if (!net->ipv4.nat_bysource)688687 return -ENOMEM;689688 return 0;···704705{705706 nf_ct_iterate_cleanup(net, &clean_nat, NULL);706707 synchronize_rcu();707707- nf_ct_free_hashtable(net->ipv4.nat_bysource, net->ipv4.nat_vmalloced,708708- net->ipv4.nat_htable_size);708708+ nf_ct_free_hashtable(net->ipv4.nat_bysource, net->ipv4.nat_htable_size);709709}710710711711static struct pernet_operations nf_nat_net_ops = {
+9-17
net/netfilter/nf_conntrack_core.c
···12021202 return 1;12031203}1204120412051205-void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size)12051205+void nf_ct_free_hashtable(void *hash, unsigned int size)12061206{12071207- if (vmalloced)12071207+ if (is_vmalloc_addr(hash))12081208 vfree(hash);12091209 else12101210 free_pages((unsigned long)hash,···12711271 goto i_see_dead_people;12721272 }1273127312741274- nf_ct_free_hashtable(net->ct.hash, net->ct.hash_vmalloc,12751275- net->ct.htable_size);12741274+ nf_ct_free_hashtable(net->ct.hash, net->ct.htable_size);12761275 nf_conntrack_ecache_fini(net);12771276 nf_conntrack_acct_fini(net);12781277 nf_conntrack_expect_fini(net);···13001301 }13011302}1302130313031303-void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls)13041304+void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls)13041305{13051306 struct hlist_nulls_head *hash;13061307 unsigned int nr_slots, i;13071308 size_t sz;13081308-13091309- *vmalloced = 0;1310130913111310 BUILD_BUG_ON(sizeof(struct hlist_nulls_head) != sizeof(struct hlist_head));13121311 nr_slots = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct hlist_nulls_head));···13121315 hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,13131316 get_order(sz));13141317 if (!hash) {13151315- *vmalloced = 1;13161318 printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n");13171319 hash = __vmalloc(sz, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,13181320 PAGE_KERNEL);···1327133113281332int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)13291333{13301330- int i, bucket, vmalloced, old_vmalloced;13341334+ int i, bucket;13311335 unsigned int hashsize, old_size;13321336 struct hlist_nulls_head *hash, *old_hash;13331337 struct nf_conntrack_tuple_hash *h;···13441348 if (!hashsize)13451349 return -EINVAL;1346135013471347- hash = nf_ct_alloc_hashtable(&hashsize, &vmalloced, 1);13511351+ hash = nf_ct_alloc_hashtable(&hashsize, 1);13481352 if (!hash)13491353 return -ENOMEM;13501354···13661370 }13671371 }13681372 old_size = init_net.ct.htable_size;13691369- old_vmalloced = init_net.ct.hash_vmalloc;13701373 old_hash = init_net.ct.hash;1371137413721375 init_net.ct.htable_size = nf_conntrack_htable_size = hashsize;13731373- init_net.ct.hash_vmalloc = vmalloced;13741376 init_net.ct.hash = hash;13751377 spin_unlock_bh(&nf_conntrack_lock);1376137813771377- nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);13791379+ nf_ct_free_hashtable(old_hash, old_size);13781380 return 0;13791381}13801382EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize);···14851491 }1486149214871493 net->ct.htable_size = nf_conntrack_htable_size;14881488- net->ct.hash = nf_ct_alloc_hashtable(&net->ct.htable_size,14891489- &net->ct.hash_vmalloc, 1);14941494+ net->ct.hash = nf_ct_alloc_hashtable(&net->ct.htable_size, 1);14901495 if (!net->ct.hash) {14911496 ret = -ENOMEM;14921497 printk(KERN_ERR "Unable to create nf_conntrack_hash\n");···15081515err_acct:15091516 nf_conntrack_expect_fini(net);15101517err_expect:15111511- nf_ct_free_hashtable(net->ct.hash, net->ct.hash_vmalloc,15121512- net->ct.htable_size);15181518+ nf_ct_free_hashtable(net->ct.hash, net->ct.htable_size);15131519err_hash:15141520 kmem_cache_destroy(net->ct.nf_conntrack_cachep);15151521err_cache: