Merge tag 'v3.10.95' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / ipv4 / af_inet.c
index f022e0e97dc55fb057560943b680b25264095ca5..14ad21e2fd310efcaa6ec8ba05543cc5602d61f9 100644 (file)
@@ -304,6 +304,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
                if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
                        build_ehash_secret();
 
+       if (protocol < 0 || protocol >= IPPROTO_MAX)
+               return -EINVAL;
+
        sock->state = SS_UNCONNECTED;
 
        /* Look for the requested type/protocol pair. */