aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-09-23 11:45:21 -0400
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-09-30 15:33:29 -0400
commit80571a9ea4ca9b6fee7ef0c13d3f31e774e0533b (patch)
tree248857009fd74504da76944b0e373d799dd5afec
parentfda75c6d9e31a901e25b922e86c8fd505c899873 (diff)
netfilter: ipset: Fix hash resizing with comments
The destroy function must take into account that resizing doesn't create new extensions so those cannot be destroyed at resize. Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
-rw-r--r--net/netfilter/ipset/ip_set_hash_gen.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
index 6efb65569e88..1cffeb977605 100644
--- a/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/net/netfilter/ipset/ip_set_hash_gen.h
@@ -393,7 +393,7 @@ mtype_flush(struct ip_set *set)
393 393
394/* Destroy the hashtable part of the set */ 394/* Destroy the hashtable part of the set */
395static void 395static void
396mtype_ahash_destroy(struct ip_set *set, struct htable *t) 396mtype_ahash_destroy(struct ip_set *set, struct htable *t, bool ext_destroy)
397{ 397{
398 struct hbucket *n; 398 struct hbucket *n;
399 u32 i; 399 u32 i;
@@ -401,7 +401,7 @@ mtype_ahash_destroy(struct ip_set *set, struct htable *t)
401 for (i = 0; i < jhash_size(t->htable_bits); i++) { 401 for (i = 0; i < jhash_size(t->htable_bits); i++) {
402 n = hbucket(t, i); 402 n = hbucket(t, i);
403 if (n->size) { 403 if (n->size) {
404 if (set->extensions & IPSET_EXT_DESTROY) 404 if (set->extensions & IPSET_EXT_DESTROY && ext_destroy)
405 mtype_ext_cleanup(set, n); 405 mtype_ext_cleanup(set, n);
406 /* FIXME: use slab cache */ 406 /* FIXME: use slab cache */
407 kfree(n->value); 407 kfree(n->value);
@@ -420,7 +420,7 @@ mtype_destroy(struct ip_set *set)
420 if (set->extensions & IPSET_EXT_TIMEOUT) 420 if (set->extensions & IPSET_EXT_TIMEOUT)
421 del_timer_sync(&h->gc); 421 del_timer_sync(&h->gc);
422 422
423 mtype_ahash_destroy(set, rcu_dereference_bh_nfnl(h->table)); 423 mtype_ahash_destroy(set, rcu_dereference_bh_nfnl(h->table), true);
424#ifdef IP_SET_HASH_WITH_RBTREE 424#ifdef IP_SET_HASH_WITH_RBTREE
425 rbtree_destroy(&h->rbtree); 425 rbtree_destroy(&h->rbtree);
426#endif 426#endif
@@ -586,7 +586,7 @@ retry:
586 mtype_data_reset_flags(data, &flags); 586 mtype_data_reset_flags(data, &flags);
587#endif 587#endif
588 read_unlock_bh(&set->lock); 588 read_unlock_bh(&set->lock);
589 mtype_ahash_destroy(set, t); 589 mtype_ahash_destroy(set, t, false);
590 if (ret == -EAGAIN) 590 if (ret == -EAGAIN)
591 goto retry; 591 goto retry;
592 return ret; 592 return ret;
@@ -607,7 +607,7 @@ retry:
607 607
608 pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name, 608 pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
609 orig->htable_bits, orig, t->htable_bits, t); 609 orig->htable_bits, orig, t->htable_bits, t);
610 mtype_ahash_destroy(set, orig); 610 mtype_ahash_destroy(set, orig, false);
611 611
612 return 0; 612 return 0;
613} 613}