X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=net%2Fipv4%2Faf_inet.c;h=5c5db6636704daa0c49fc13e84b2c5b282a44ed3;hb=19c52240a6be6332d73b54cb20e69dab3641b393;hp=11c4ca13ec3b0434090b3d5cbdd7a0aae784952f;hpb=52e9a33333fc337d03ffb865048f9ccae8552a8d;p=firefly-linux-kernel-4.4.55.git diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 11c4ca13ec3b..5c5db6636704 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -257,6 +257,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, int try_loading_module = 0; int err; + if (protocol < 0 || protocol >= IPPROTO_MAX) + return -EINVAL; + sock->state = SS_UNCONNECTED; /* Look for the requested type/protocol pair. */