Commit 7674d511 authored by Patrick McHardy's avatar Patrick McHardy Committed by Patrick McHardy

[NETFILTER]: Don't call ip_conntrack_put with ip_conntrack_lock held

parent e595a7f8
...@@ -301,7 +301,7 @@ clean_from_lists(struct ip_conntrack *ct) ...@@ -301,7 +301,7 @@ clean_from_lists(struct ip_conntrack *ct)
static void static void
destroy_conntrack(struct nf_conntrack *nfct) destroy_conntrack(struct nf_conntrack *nfct)
{ {
struct ip_conntrack *ct = (struct ip_conntrack *)nfct; struct ip_conntrack *ct = (struct ip_conntrack *)nfct, *master = NULL;
struct ip_conntrack_protocol *proto; struct ip_conntrack_protocol *proto;
DEBUGP("destroy_conntrack(%p)\n", ct); DEBUGP("destroy_conntrack(%p)\n", ct);
...@@ -328,12 +328,15 @@ destroy_conntrack(struct nf_conntrack *nfct) ...@@ -328,12 +328,15 @@ destroy_conntrack(struct nf_conntrack *nfct)
/* can't call __unexpect_related here, /* can't call __unexpect_related here,
* since it would screw up expect_list */ * since it would screw up expect_list */
list_del(&ct->master->expected_list); list_del(&ct->master->expected_list);
ip_conntrack_put(ct->master->expectant); master = ct->master->expectant;
} }
kfree(ct->master); kfree(ct->master);
} }
WRITE_UNLOCK(&ip_conntrack_lock); WRITE_UNLOCK(&ip_conntrack_lock);
if (master)
ip_conntrack_put(master);
DEBUGP("destroy_conntrack: returning ct=%p to slab\n", ct); DEBUGP("destroy_conntrack: returning ct=%p to slab\n", ct);
kmem_cache_free(ip_conntrack_cachep, ct); kmem_cache_free(ip_conntrack_cachep, ct);
atomic_dec(&ip_conntrack_count); atomic_dec(&ip_conntrack_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment