Merge branch 'next' into for-linus
[linux-2.6-microblaze.git] / net / l2tp / l2tp_core.c
index fcb53ed..6d7ef78 100644 (file)
@@ -1458,6 +1458,9 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net,
        if (sk->sk_type != SOCK_DGRAM)
                return -EPROTONOSUPPORT;
 
+       if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6)
+               return -EPROTONOSUPPORT;
+
        if ((encap == L2TP_ENCAPTYPE_UDP && sk->sk_protocol != IPPROTO_UDP) ||
            (encap == L2TP_ENCAPTYPE_IP && sk->sk_protocol != IPPROTO_L2TP))
                return -EPROTONOSUPPORT;