diff options
author | Patrick McHarrdy <kaber@trash.net> | 2007-06-05 19:55:27 (GMT) |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-06-07 20:40:26 (GMT) |
commit | 3c158f7f57601bc27eab82f0dc4fd3fad314d845 (patch) | |
tree | 03c8f9d7fa1e51d852ff6b90c35030491613df03 /net/netfilter/nf_conntrack_expect.c | |
parent | 51055be81c3cb14d0165a7432b787098b817fd35 (diff) | |
download | linux-3c158f7f57601bc27eab82f0dc4fd3fad314d845.tar.xz |
[NETFILTER]: nf_conntrack: fix helper module unload races
When a helper module is unloaded all conntracks refering to it have their
helper pointer NULLed out, leading to lots of races. In most places this
can be fixed by proper use of RCU (they do already check for != NULL,
but in a racy way), additionally nf_conntrack_expect_related needs to
bail out when no helper is present.
Also remove two paranoid BUG_ONs in nf_conntrack_proto_gre that are racy
and not worth fixing.
Signed-off-by: Patrick McHarrdy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_conntrack_expect.c')
-rw-r--r-- | net/netfilter/nf_conntrack_expect.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 117cbfd..504fb6c 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c @@ -337,6 +337,10 @@ int nf_conntrack_expect_related(struct nf_conntrack_expect *expect) NF_CT_ASSERT(master_help); write_lock_bh(&nf_conntrack_lock); + if (!master_help->helper) { + ret = -ESHUTDOWN; + goto out; + } list_for_each_entry(i, &nf_conntrack_expect_list, list) { if (expect_matches(i, expect)) { /* Refresh timer: if it's dying, ignore.. */ |