netfilter: arp_tables: simplify translate_compat_table args
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / af_inet.c
index 11c4ca13ec3b0434090b3d5cbdd7a0aae784952f..5c5db6636704daa0c49fc13e84b2c5b282a44ed3 100644 (file)
@@ -257,6 +257,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
        int try_loading_module = 0;
        int err;
 
+       if (protocol < 0 || protocol >= IPPROTO_MAX)
+               return -EINVAL;
+
        sock->state = SS_UNCONNECTED;
 
        /* Look for the requested type/protocol pair. */