Merge branch 'for-arm' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal...
[cascardo/linux.git] / net / netfilter / nf_conntrack_core.c
index 729f157..ac3af97 100644 (file)
@@ -683,10 +683,7 @@ __nf_conntrack_alloc(struct net *net, u16 zone,
            unlikely(atomic_read(&net->ct.count) > nf_conntrack_max)) {
                if (!early_drop(net, hash_bucket(hash, net))) {
                        atomic_dec(&net->ct.count);
-                       if (net_ratelimit())
-                               printk(KERN_WARNING
-                                      "nf_conntrack: table full, dropping"
-                                      " packet.\n");
+                       net_warn_ratelimited("nf_conntrack: table full, dropping packet\n");
                        return ERR_PTR(-ENOMEM);
                }
        }
@@ -1152,8 +1149,9 @@ static struct nf_ct_ext_type nf_ct_zone_extend __read_mostly = {
 int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
                               const struct nf_conntrack_tuple *tuple)
 {
-       NLA_PUT_BE16(skb, CTA_PROTO_SRC_PORT, tuple->src.u.tcp.port);
-       NLA_PUT_BE16(skb, CTA_PROTO_DST_PORT, tuple->dst.u.tcp.port);
+       if (nla_put_be16(skb, CTA_PROTO_SRC_PORT, tuple->src.u.tcp.port) ||
+           nla_put_be16(skb, CTA_PROTO_DST_PORT, tuple->dst.u.tcp.port))
+               goto nla_put_failure;
        return 0;
 
 nla_put_failure:
@@ -1335,7 +1333,6 @@ static void nf_conntrack_cleanup_init_net(void)
        while (untrack_refs() > 0)
                schedule();
 
-       nf_conntrack_helper_fini();
        nf_conntrack_proto_fini();
 #ifdef CONFIG_NF_CONNTRACK_ZONES
        nf_ct_extend_unregister(&nf_ct_zone_extend);
@@ -1353,6 +1350,7 @@ static void nf_conntrack_cleanup_net(struct net *net)
        }
 
        nf_ct_free_hashtable(net->ct.hash, net->ct.htable_size);
+       nf_conntrack_helper_fini(net);
        nf_conntrack_timeout_fini(net);
        nf_conntrack_ecache_fini(net);
        nf_conntrack_tstamp_fini(net);
@@ -1503,10 +1501,6 @@ static int nf_conntrack_init_init_net(void)
        if (ret < 0)
                goto err_proto;
 
-       ret = nf_conntrack_helper_init();
-       if (ret < 0)
-               goto err_helper;
-
 #ifdef CONFIG_NF_CONNTRACK_ZONES
        ret = nf_ct_extend_register(&nf_ct_zone_extend);
        if (ret < 0)
@@ -1524,10 +1518,8 @@ static int nf_conntrack_init_init_net(void)
 
 #ifdef CONFIG_NF_CONNTRACK_ZONES
 err_extend:
-       nf_conntrack_helper_fini();
-#endif
-err_helper:
        nf_conntrack_proto_fini();
+#endif
 err_proto:
        return ret;
 }
@@ -1588,9 +1580,14 @@ static int nf_conntrack_init_net(struct net *net)
        ret = nf_conntrack_timeout_init(net);
        if (ret < 0)
                goto err_timeout;
+       ret = nf_conntrack_helper_init(net);
+       if (ret < 0)
+               goto err_helper;
 
        return 0;
 
+err_helper:
+       nf_conntrack_timeout_fini(net);
 err_timeout:
        nf_conntrack_ecache_fini(net);
 err_ecache: