diff options
author | Liping Zhang <liping.zhang@spreadtrum.com> | 2016-07-03 01:18:45 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-07-11 05:44:34 -0400 |
commit | 8786a9716d028083f56f944996883f7d1a05919e (patch) | |
tree | 7c2691ec8ade17c7e90ff1d8a3a99bc23f35861e /net/netfilter | |
parent | 474803d37e7fb6291d22cb964014afe457ba5212 (diff) |
netfilter: nf_ct_helper: unlink helper again when hash resize happen
From: Liping Zhang <liping.zhang@spreadtrum.com>
Similar to ctnl_untimeout, when hash resize happened, we should try
to do unhelp from the 0# bucket again.
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/nf_conntrack_helper.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index 3a1a88b9bafa..a4294e949cdc 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
@@ -409,6 +409,8 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me) | |||
409 | struct nf_conntrack_expect *exp; | 409 | struct nf_conntrack_expect *exp; |
410 | const struct hlist_node *next; | 410 | const struct hlist_node *next; |
411 | const struct hlist_nulls_node *nn; | 411 | const struct hlist_nulls_node *nn; |
412 | unsigned int last_hsize; | ||
413 | spinlock_t *lock; | ||
412 | struct net *net; | 414 | struct net *net; |
413 | unsigned int i; | 415 | unsigned int i; |
414 | 416 | ||
@@ -446,13 +448,18 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me) | |||
446 | rtnl_unlock(); | 448 | rtnl_unlock(); |
447 | 449 | ||
448 | local_bh_disable(); | 450 | local_bh_disable(); |
449 | for (i = 0; i < nf_conntrack_htable_size; i++) { | 451 | restart: |
450 | nf_conntrack_lock(&nf_conntrack_locks[i % CONNTRACK_LOCKS]); | 452 | last_hsize = nf_conntrack_htable_size; |
451 | if (i < nf_conntrack_htable_size) { | 453 | for (i = 0; i < last_hsize; i++) { |
452 | hlist_nulls_for_each_entry(h, nn, &nf_conntrack_hash[i], hnnode) | 454 | lock = &nf_conntrack_locks[i % CONNTRACK_LOCKS]; |
453 | unhelp(h, me); | 455 | nf_conntrack_lock(lock); |
456 | if (last_hsize != nf_conntrack_htable_size) { | ||
457 | spin_unlock(lock); | ||
458 | goto restart; | ||
454 | } | 459 | } |
455 | spin_unlock(&nf_conntrack_locks[i % CONNTRACK_LOCKS]); | 460 | hlist_nulls_for_each_entry(h, nn, &nf_conntrack_hash[i], hnnode) |
461 | unhelp(h, me); | ||
462 | spin_unlock(lock); | ||
456 | } | 463 | } |
457 | local_bh_enable(); | 464 | local_bh_enable(); |
458 | } | 465 | } |