diff options
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 9af734d135b9..7517aea06f71 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -275,6 +275,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, if (!current_has_network()) return -EACCES; + if (protocol < 0 || protocol >= IPPROTO_MAX) + return -EINVAL; + sock->state = SS_UNCONNECTED; /* Look for the requested type/protocol pair. */ |