From 8e778f02fb5fc3cdc8328855f909ae5b9b50a180 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 12 Feb 2007 11:14:11 -0800 Subject: [PATCH] --- yaml --- r: 48111 b: refs/heads/master c: 982d9a9ce389c396bc83ce29d799937f379ddcb7 h: refs/heads/master i: 48109: d7fb19b7b52edf08810970bfd39ccc1faaee3dce 48107: 8da51ccaad40d56d1bb6b61e92345e1b3e9d4a19 48103: 28d9cea7fb58568006160176f5f0a24d5a140a12 48095: b6d9fdcbf4403682209add00912a88c6316efc92 v: v3 --- [refs] | 2 +- trunk/net/ipv4/netfilter/nf_nat_core.c | 7 ++++--- trunk/net/netfilter/nf_conntrack_core.c | 9 ++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 174adcc08ca2..ee3e1600201a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6b48a7d08d1bb2e3932bce1662fe411304acc18f +refs/heads/master: 982d9a9ce389c396bc83ce29d799937f379ddcb7 diff --git a/trunk/net/ipv4/netfilter/nf_nat_core.c b/trunk/net/ipv4/netfilter/nf_nat_core.c index 5156d5d6c3b8..2c01378d3592 100644 --- a/trunk/net/ipv4/netfilter/nf_nat_core.c +++ b/trunk/net/ipv4/netfilter/nf_nat_core.c @@ -617,8 +617,8 @@ static int __init nf_nat_init(void) } /* FIXME: Man, this is a hack. */ - NF_CT_ASSERT(nf_conntrack_destroyed == NULL); - nf_conntrack_destroyed = &nf_nat_cleanup_conntrack; + NF_CT_ASSERT(rcu_dereference(nf_conntrack_destroyed) == NULL); + rcu_assign_pointer(nf_conntrack_destroyed, nf_nat_cleanup_conntrack); /* Initialize fake conntrack so that NAT will skip it */ nf_conntrack_untracked.status |= IPS_NAT_DONE_MASK; @@ -642,7 +642,8 @@ static int clean_nat(struct nf_conn *i, void *data) static void __exit nf_nat_cleanup(void) { nf_ct_iterate_cleanup(&clean_nat, NULL); - nf_conntrack_destroyed = NULL; + rcu_assign_pointer(nf_conntrack_destroyed, NULL); + synchronize_rcu(); vfree(bysource); nf_ct_l3proto_put(l3proto); } diff --git a/trunk/net/netfilter/nf_conntrack_core.c b/trunk/net/netfilter/nf_conntrack_core.c index d59640e2377b..0cc150560fb7 100644 --- a/trunk/net/netfilter/nf_conntrack_core.c +++ b/trunk/net/netfilter/nf_conntrack_core.c @@ -318,6 +318,7 @@ destroy_conntrack(struct nf_conntrack *nfct) struct nf_conn_help *help = nfct_help(ct); struct nf_conntrack_l3proto *l3proto; struct nf_conntrack_l4proto *l4proto; + typeof(nf_conntrack_destroyed) destroyed; DEBUGP("destroy_conntrack(%p)\n", ct); NF_CT_ASSERT(atomic_read(&nfct->use) == 0); @@ -341,10 +342,12 @@ destroy_conntrack(struct nf_conntrack *nfct) ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.protonum); if (l4proto && l4proto->destroy) l4proto->destroy(ct); - rcu_read_unlock(); - if (nf_conntrack_destroyed) - nf_conntrack_destroyed(ct); + destroyed = rcu_dereference(nf_conntrack_destroyed); + if (destroyed) + destroyed(ct); + + rcu_read_unlock(); write_lock_bh(&nf_conntrack_lock); /* Expectations will have been removed in clean_from_lists,