ipvs: Hoist computation of ipvs earlier in sctp_conn_schedule
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 21 Sep 2015 18:01:38 +0000 (13:01 -0500)
committerSimon Horman <horms@verge.net.au>
Thu, 24 Sep 2015 00:34:32 +0000 (09:34 +0900)
The addition of sysctl_sloppy_sctp in sctp_conn_schedule resulted
in a use of ipvs before it was computed.  Hoist the computation of
ipvs earlier to avoid this problem.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
net/netfilter/ipvs/ip_vs_proto_sctp.c

index 2026fca7e1c36f12db1351e7c14e9eba8ad8b8e1..ac628a9afdb521c243d79b2f415ee98a3f41d0c3 100644 (file)
@@ -20,6 +20,9 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
        sctp_sctphdr_t *sh, _sctph;
        __be16 _ports[2], *ports = NULL;
 
+       net = skb_net(skb);
+       ipvs = net_ipvs(net);
+
        if (likely(!ip_vs_iph_icmp(iph))) {
                sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph);
                if (sh) {
@@ -40,8 +43,6 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
                return 0;
        }
 
-       net = skb_net(skb);
-       ipvs = net_ipvs(net);
        rcu_read_lock();
        if (likely(!ip_vs_iph_inverse(iph)))
                svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,