Message ID | 20240307142030.2708698-3-Ilia.Gavrilov@infotecs.ru (mailing list archive) |
---|---|
State | Accepted |
Commit | 4bb3ba7b74fceec6f558745b25a43c6521cf5506 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | fix incorrect parameter validation in the *_get_sockopt() functions | expand |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index e474b201900f..17231c0f8830 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2792,11 +2792,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, if (get_user(len, optlen)) return -EFAULT; - len = min_t(unsigned int, len, sizeof(int)); - if (len < 0) return -EINVAL; + len = min_t(unsigned int, len, sizeof(int)); + switch (optname) { case UDP_CORK: val = udp_test_bit(CORK, sk);