Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / net / l2tp / l2tp_ip.c
index a753c9b..2e22254 100644 (file)
@@ -127,6 +127,7 @@ static int l2tp_ip_recv(struct sk_buff *skb)
        unsigned char *ptr, *optr;
        struct l2tp_session *session;
        struct l2tp_tunnel *tunnel = NULL;
+       struct iphdr *iph;
        int length;
        int offset;
 
@@ -189,21 +190,16 @@ pass_up:
                goto discard;
 
        tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
-       tunnel = l2tp_tunnel_find(&init_net, tunnel_id);
-       if (tunnel != NULL)
-               sk = tunnel->sock;
-       else {
-               struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
-
-               read_lock_bh(&l2tp_ip_lock);
-               sk = __l2tp_ip_bind_lookup(&init_net, iph->daddr, 0, tunnel_id);
-               read_unlock_bh(&l2tp_ip_lock);
-       }
+       iph = (struct iphdr *)skb_network_header(skb);
 
-       if (sk == NULL)
+       read_lock_bh(&l2tp_ip_lock);
+       sk = __l2tp_ip_bind_lookup(&init_net, iph->daddr, 0, tunnel_id);
+       if (!sk) {
+               read_unlock_bh(&l2tp_ip_lock);
                goto discard;
-
+       }
        sock_hold(sk);
+       read_unlock_bh(&l2tp_ip_lock);
 
        if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
                goto discard_put;
@@ -432,7 +428,7 @@ static int l2tp_ip_backlog_recv(struct sock *sk, struct sk_buff *skb)
 drop:
        IP_INC_STATS(&init_net, IPSTATS_MIB_INDISCARDS);
        kfree_skb(skb);
-       return -1;
+       return 0;
 }
 
 /* Userspace will call sendmsg() on the tunnel socket to send L2TP