diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index b9c2de84a8a212d137e1ba0c17bc1125dd5b288d..0f0f94a40335e7a24a68181f1791d164d49cd3e2 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -705,6 +705,11 @@ int datagram_send_ctl(struct net *net, } *hlimit = *(int *)CMSG_DATA(cmsg); + if (*hlimit < -1 || *hlimit > 0xff) { + err = -EINVAL; + goto exit_f; + } + break; case IPV6_TCLASS: