Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8786a971 authored by Liping Zhang's avatar Liping Zhang Committed by Pablo Neira Ayuso
Browse files

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: default avatarLiping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 474803d3
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -409,6 +409,8 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
	struct nf_conntrack_expect *exp;
	const struct hlist_node *next;
	const struct hlist_nulls_node *nn;
	unsigned int last_hsize;
	spinlock_t *lock;
	struct net *net;
	unsigned int i;

@@ -446,13 +448,18 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
	rtnl_unlock();

	local_bh_disable();
	for (i = 0; i < nf_conntrack_htable_size; i++) {
		nf_conntrack_lock(&nf_conntrack_locks[i % CONNTRACK_LOCKS]);
		if (i < nf_conntrack_htable_size) {
restart:
	last_hsize = nf_conntrack_htable_size;
	for (i = 0; i < last_hsize; i++) {
		lock = &nf_conntrack_locks[i % CONNTRACK_LOCKS];
		nf_conntrack_lock(lock);
		if (last_hsize != nf_conntrack_htable_size) {
			spin_unlock(lock);
			goto restart;
		}
		hlist_nulls_for_each_entry(h, nn, &nf_conntrack_hash[i], hnnode)
			unhelp(h, me);
		}
		spin_unlock(&nf_conntrack_locks[i % CONNTRACK_LOCKS]);
		spin_unlock(lock);
	}
	local_bh_enable();
}