Merge tag 'powerpc-4.4-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[firefly-linux-kernel-4.4.55.git] / net / ipv6 / af_inet6.c
index 8ec0df75f1c4f81bea71cb466c4da802c39099d8..9f5137cd604e51316c6c3a85ca5423b30ed7ce30 100644 (file)
@@ -109,6 +109,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
        int try_loading_module = 0;
        int err;
 
+       if (protocol < 0 || protocol >= IPPROTO_MAX)
+               return -EINVAL;
+
        /* Look for the requested type/protocol pair. */
 lookup_protocol:
        err = -ESOCKTNOSUPPORT;