openvswitch: __nf_ct_l{3,4}proto_find() always return a valid pointer
[cascardo/linux.git] / net / openvswitch / conntrack.c
index 1b9d286..9f0bc49 100644 (file)
@@ -367,6 +367,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key,
        } else if (key->eth.type == htons(ETH_P_IPV6)) {
                enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
 
+               skb_orphan(skb);
                memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
                err = nf_ct_frag6_gather(net, skb, user);
                if (err)
@@ -438,20 +439,12 @@ ovs_ct_find_existing(struct net *net, const struct nf_conntrack_zone *zone,
        u8 protonum;
 
        l3proto = __nf_ct_l3proto_find(l3num);
-       if (!l3proto) {
-               pr_debug("ovs_ct_find_existing: Can't get l3proto\n");
-               return NULL;
-       }
        if (l3proto->get_l4proto(skb, skb_network_offset(skb), &dataoff,
                                 &protonum) <= 0) {
                pr_debug("ovs_ct_find_existing: Can't get protonum\n");
                return NULL;
        }
        l4proto = __nf_ct_l4proto_find(l3num, protonum);
-       if (!l4proto) {
-               pr_debug("ovs_ct_find_existing: Can't get l4proto\n");
-               return NULL;
-       }
        if (!nf_ct_get_tuple(skb, skb_network_offset(skb), dataoff, l3num,
                             protonum, net, &tuple, l3proto, l4proto)) {
                pr_debug("ovs_ct_find_existing: Can't get tuple\n");
@@ -1344,7 +1337,7 @@ void ovs_ct_init(struct net *net)
        unsigned int n_bits = sizeof(struct ovs_key_ct_labels) * BITS_PER_BYTE;
        struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
 
-       if (nf_connlabels_get(net, n_bits)) {
+       if (nf_connlabels_get(net, n_bits - 1)) {
                ovs_net->xt_label = false;
                OVS_NLERR(true, "Failed to set connlabel length");
        } else {