Message ID | 20161113112421.823737999@linuxfoundation.org |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
--- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -4683,7 +4683,7 @@ static int sctp_getsockopt_disable_fragm static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, int __user *optlen) { - if (len <= 0) + if (len == 0) return -EINVAL; if (len > sizeof(struct sctp_event_subscribe)) len = sizeof(struct sctp_event_subscribe); @@ -6426,6 +6426,9 @@ static int sctp_getsockopt(struct sock * if (get_user(len, optlen)) return -EFAULT; + if (len < 0) + return -EINVAL; + lock_sock(sk); switch (optname) {