@@ -1202,9 +1202,9 @@ static int kill_all(struct nf_conn *i, void *data)
12021202 return 1 ;
12031203}
12041204
1205- void nf_ct_free_hashtable (void * hash , int vmalloced , unsigned int size )
1205+ void nf_ct_free_hashtable (void * hash , unsigned int size )
12061206{
1207- if (vmalloced )
1207+ if (is_vmalloc_addr ( hash ) )
12081208 vfree (hash );
12091209 else
12101210 free_pages ((unsigned long )hash ,
@@ -1271,8 +1271,7 @@ static void nf_conntrack_cleanup_net(struct net *net)
12711271 goto i_see_dead_people ;
12721272 }
12731273
1274- nf_ct_free_hashtable (net -> ct .hash , net -> ct .hash_vmalloc ,
1275- net -> ct .htable_size );
1274+ 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 );
@@ -1301,21 +1300,18 @@ void nf_conntrack_cleanup(struct net *net)
13011300 }
13021301}
13031302
1304- void * nf_ct_alloc_hashtable (unsigned int * sizep , int * vmalloced , int nulls )
1303+ void * nf_ct_alloc_hashtable (unsigned int * sizep , int nulls )
13051304{
13061305 struct hlist_nulls_head * hash ;
13071306 unsigned int nr_slots , i ;
13081307 size_t sz ;
13091308
1310- * vmalloced = 0 ;
1311-
13121309 BUILD_BUG_ON (sizeof (struct hlist_nulls_head ) != sizeof (struct hlist_head ));
13131310 nr_slots = * sizep = roundup (* sizep , PAGE_SIZE / sizeof (struct hlist_nulls_head ));
13141311 sz = nr_slots * sizeof (struct hlist_nulls_head );
13151312 hash = (void * )__get_free_pages (GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO ,
13161313 get_order (sz ));
13171314 if (!hash ) {
1318- * vmalloced = 1 ;
13191315 printk (KERN_WARNING "nf_conntrack: falling back to vmalloc.\n" );
13201316 hash = __vmalloc (sz , GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO ,
13211317 PAGE_KERNEL );
@@ -1331,7 +1327,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
13311327
13321328int nf_conntrack_set_hashsize (const char * val , struct kernel_param * kp )
13331329{
1334- int i , bucket , vmalloced , old_vmalloced ;
1330+ int i , bucket ;
13351331 unsigned int hashsize , old_size ;
13361332 struct hlist_nulls_head * hash , * old_hash ;
13371333 struct nf_conntrack_tuple_hash * h ;
@@ -1348,7 +1344,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
13481344 if (!hashsize )
13491345 return - EINVAL ;
13501346
1351- hash = nf_ct_alloc_hashtable (& hashsize , & vmalloced , 1 );
1347+ hash = nf_ct_alloc_hashtable (& hashsize , 1 );
13521348 if (!hash )
13531349 return - ENOMEM ;
13541350
@@ -1370,15 +1366,13 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
13701366 }
13711367 }
13721368 old_size = init_net .ct .htable_size ;
1373- old_vmalloced = init_net .ct .hash_vmalloc ;
13741369 old_hash = init_net .ct .hash ;
13751370
13761371 init_net .ct .htable_size = nf_conntrack_htable_size = hashsize ;
1377- init_net .ct .hash_vmalloc = vmalloced ;
13781372 init_net .ct .hash = hash ;
13791373 spin_unlock_bh (& nf_conntrack_lock );
13801374
1381- nf_ct_free_hashtable (old_hash , old_vmalloced , old_size );
1375+ nf_ct_free_hashtable (old_hash , old_size );
13821376 return 0 ;
13831377}
13841378EXPORT_SYMBOL_GPL (nf_conntrack_set_hashsize );
@@ -1491,8 +1485,7 @@ static int nf_conntrack_init_net(struct net *net)
14911485 }
14921486
14931487 net -> ct .htable_size = nf_conntrack_htable_size ;
1494- net -> ct .hash = nf_ct_alloc_hashtable (& net -> ct .htable_size ,
1495- & net -> ct .hash_vmalloc , 1 );
1488+ net -> ct .hash = nf_ct_alloc_hashtable (& net -> ct .htable_size , 1 );
14961489 if (!net -> ct .hash ) {
14971490 ret = - ENOMEM ;
14981491 printk (KERN_ERR "Unable to create nf_conntrack_hash\n" );
@@ -1515,8 +1508,7 @@ static int nf_conntrack_init_net(struct net *net)
15151508err_acct :
15161509 nf_conntrack_expect_fini (net );
15171510err_expect :
1518- nf_ct_free_hashtable (net -> ct .hash , net -> ct .hash_vmalloc ,
1519- net -> ct .htable_size );
1511+ nf_ct_free_hashtable (net -> ct .hash , net -> ct .htable_size );
15201512err_hash :
15211513 kmem_cache_destroy (net -> ct .nf_conntrack_cachep );
15221514err_cache :
0 commit comments