|
@@ -5653,6 +5653,9 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len,
|
|
|
if (len < sizeof(sctp_assoc_t))
|
|
|
return -EINVAL;
|
|
|
|
|
|
+ /* Allow the struct to grow and fill in as much as possible */
|
|
|
+ len = min_t(size_t, len, sizeof(sas));
|
|
|
+
|
|
|
if (copy_from_user(&sas, optval, len))
|
|
|
return -EFAULT;
|
|
|
|
|
@@ -5686,9 +5689,6 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len,
|
|
|
/* Mark beginning of a new observation period */
|
|
|
asoc->stats.max_obs_rto = asoc->rto_min;
|
|
|
|
|
|
- /* Allow the struct to grow and fill in as much as possible */
|
|
|
- len = min_t(size_t, len, sizeof(sas));
|
|
|
-
|
|
|
if (put_user(len, optlen))
|
|
|
return -EFAULT;
|
|
|
|