X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=net%2Fipv4%2Faf_inet.c;h=5c5db6636704daa0c49fc13e84b2c5b282a44ed3;hb=6545f3189707c9105fcf160c2da2ddd2dacca331;hp=11c4ca13ec3b0434090b3d5cbdd7a0aae784952f;hpb=f20780f3e8feec0eebcf9fb41e1d90202fffaeff;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. */