net: add validation for the socket syscall protocol argument
[pandora-kernel.git] / net / ax25 / af_ax25.c
index 7b8db0e..a314cfd 100644 (file)
@@ -806,6 +806,9 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
        struct sock *sk;
        ax25_cb *ax25;
 
+       if (protocol < 0 || protocol > SK_PROTOCOL_MAX)
+               return -EINVAL;
+
        if (!net_eq(net, &init_net))
                return -EAFNOSUPPORT;