netfilter: x_tables: check for size overflow
[firefly-linux-kernel-4.4.55.git] / net / decnet / af_decnet.c
index eebf5ac8ce18abdb7ac094a1e6de081fcbfa79aa..13d6b1a6e0fc2b0730827d93d154d6464a3e58ec 100644 (file)
@@ -678,6 +678,9 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
 {
        struct sock *sk;
 
+       if (protocol < 0 || protocol > SK_PROTOCOL_MAX)
+               return -EINVAL;
+
        if (!net_eq(net, &init_net))
                return -EAFNOSUPPORT;