aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c7
-rw-r--r--net/netfilter/nf_conntrack_core.c9
2 files changed, 10 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 5156d5d6c3b8..2c01378d3592 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -617,8 +617,8 @@ static int __init nf_nat_init(void)
617 } 617 }
618 618
619 /* FIXME: Man, this is a hack. <SIGH> */ 619 /* FIXME: Man, this is a hack. <SIGH> */
620 NF_CT_ASSERT(nf_conntrack_destroyed == NULL); 620 NF_CT_ASSERT(rcu_dereference(nf_conntrack_destroyed) == NULL);
621 nf_conntrack_destroyed = &nf_nat_cleanup_conntrack; 621 rcu_assign_pointer(nf_conntrack_destroyed, nf_nat_cleanup_conntrack);
622 622
623 /* Initialize fake conntrack so that NAT will skip it */ 623 /* Initialize fake conntrack so that NAT will skip it */
624 nf_conntrack_untracked.status |= IPS_NAT_DONE_MASK; 624 nf_conntrack_untracked.status |= IPS_NAT_DONE_MASK;
@@ -642,7 +642,8 @@ static int clean_nat(struct nf_conn *i, void *data)
642static void __exit nf_nat_cleanup(void) 642static void __exit nf_nat_cleanup(void)
643{ 643{
644 nf_ct_iterate_cleanup(&clean_nat, NULL); 644 nf_ct_iterate_cleanup(&clean_nat, NULL);
645 nf_conntrack_destroyed = NULL; 645 rcu_assign_pointer(nf_conntrack_destroyed, NULL);
646 synchronize_rcu();
646 vfree(bysource); 647 vfree(bysource);
647 nf_ct_l3proto_put(l3proto); 648 nf_ct_l3proto_put(l3proto);
648} 649}
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index d59640e2377b..0cc150560fb7 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -318,6 +318,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
318 struct nf_conn_help *help = nfct_help(ct); 318 struct nf_conn_help *help = nfct_help(ct);
319 struct nf_conntrack_l3proto *l3proto; 319 struct nf_conntrack_l3proto *l3proto;
320 struct nf_conntrack_l4proto *l4proto; 320 struct nf_conntrack_l4proto *l4proto;
321 typeof(nf_conntrack_destroyed) destroyed;
321 322
322 DEBUGP("destroy_conntrack(%p)\n", ct); 323 DEBUGP("destroy_conntrack(%p)\n", ct);
323 NF_CT_ASSERT(atomic_read(&nfct->use) == 0); 324 NF_CT_ASSERT(atomic_read(&nfct->use) == 0);
@@ -341,10 +342,12 @@ destroy_conntrack(struct nf_conntrack *nfct)
341 ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.protonum); 342 ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.protonum);
342 if (l4proto && l4proto->destroy) 343 if (l4proto && l4proto->destroy)
343 l4proto->destroy(ct); 344 l4proto->destroy(ct);
344 rcu_read_unlock();
345 345
346 if (nf_conntrack_destroyed) 346 destroyed = rcu_dereference(nf_conntrack_destroyed);
347 nf_conntrack_destroyed(ct); 347 if (destroyed)
348 destroyed(ct);
349
350 rcu_read_unlock();
348 351
349 write_lock_bh(&nf_conntrack_lock); 352 write_lock_bh(&nf_conntrack_lock);
350 /* Expectations will have been removed in clean_from_lists, 353 /* Expectations will have been removed in clean_from_lists,