|
@@ -123,6 +123,7 @@ static int l2tp_ip_recv(struct sk_buff *skb)
|
|
unsigned char *ptr, *optr;
|
|
unsigned char *ptr, *optr;
|
|
struct l2tp_session *session;
|
|
struct l2tp_session *session;
|
|
struct l2tp_tunnel *tunnel = NULL;
|
|
struct l2tp_tunnel *tunnel = NULL;
|
|
|
|
+ struct iphdr *iph;
|
|
int length;
|
|
int length;
|
|
|
|
|
|
if (!pskb_may_pull(skb, 4))
|
|
if (!pskb_may_pull(skb, 4))
|
|
@@ -178,24 +179,17 @@ pass_up:
|
|
goto discard;
|
|
goto discard;
|
|
|
|
|
|
tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
|
|
tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
|
|
- tunnel = l2tp_tunnel_find(net, tunnel_id);
|
|
|
|
- if (tunnel) {
|
|
|
|
- sk = tunnel->sock;
|
|
|
|
- sock_hold(sk);
|
|
|
|
- } else {
|
|
|
|
- struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
|
|
|
|
-
|
|
|
|
- read_lock_bh(&l2tp_ip_lock);
|
|
|
|
- sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr,
|
|
|
|
- inet_iif(skb), tunnel_id);
|
|
|
|
- if (!sk) {
|
|
|
|
- read_unlock_bh(&l2tp_ip_lock);
|
|
|
|
- goto discard;
|
|
|
|
- }
|
|
|
|
|
|
+ iph = (struct iphdr *)skb_network_header(skb);
|
|
|
|
|
|
- sock_hold(sk);
|
|
|
|
|
|
+ read_lock_bh(&l2tp_ip_lock);
|
|
|
|
+ sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr, inet_iif(skb),
|
|
|
|
+ tunnel_id);
|
|
|
|
+ if (!sk) {
|
|
read_unlock_bh(&l2tp_ip_lock);
|
|
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))
|
|
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
|
|
goto discard_put;
|
|
goto discard_put;
|