RDS: null pointer dereference in rds_atomic_free_op
[pandora-kernel.git] / net / decnet / af_decnet.c
index 16fbf8c..c0486c8 100644 (file)
@@ -681,6 +681,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;