commit 22e7410b760b9c1777839fdd10382c60df8cbda2
tree a9bee35b95ad4e197e76a022d45ac0779f115d28
parent dafc741cf23351a6f43895579a72ab8818ba00ae
author Yasuyuki Kozakai <[EMAIL PROTECTED]> 1164651959 -0800
committer David S. Miller <[EMAIL PROTECTED]> 1164776375 -0800

[NETFILTER]: nf_conntrack: fix the race on assign helper to new conntrack

The found helper cannot be assigned to conntrack after unlocking
nf_conntrack_lock. This tries to find helper to assign again.

Signed-off-by: Yasuyuki Kozakai <[EMAIL PROTECTED]>
Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

 net/netfilter/nf_conntrack_core.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 836541e..0f58307 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -893,12 +893,6 @@ __nf_conntrack_alloc(const struct nf_con
 
        memset(conntrack, 0, nf_ct_cache[features].size);
        conntrack->features = features;
-       if (helper) {
-               struct nf_conn_help *help = nfct_help(conntrack);
-               NF_CT_ASSERT(help);
-               help->helper = helper;
-       }
-
        atomic_set(&conntrack->ct_general.use, 1);
        conntrack->ct_general.destroy = destroy_conntrack;
        conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
@@ -982,8 +976,13 @@ init_conntrack(const struct nf_conntrack
 #endif
                nf_conntrack_get(&conntrack->master->ct_general);
                NF_CT_STAT_INC(expect_new);
-       } else
+       } else {
+               struct nf_conn_help *help = nfct_help(conntrack);
+
+               if (help)
+                       help->helper = __nf_ct_helper_find(&repl_tuple);
                NF_CT_STAT_INC(new);
+       }
 
        /* Overload tuple linked list to put us in unconfirmed list. */
        list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to