Commit f6778aab authored by Andrei Pelinescu-Onciul's avatar Andrei Pelinescu-Onciul Committed by Vlad Yasevich

sctp: limit maximum autoclose setsockopt value

To avoid overflowing the maximum timer interval when transforming
the  autoclose interval from seconds to jiffies, limit the maximum
autoclose value to MAX_SCHEDULE_TIMEOUT/HZ.
Signed-off-by: default avatarAndrei Pelinescu-Onciul <andrei@iptel.org>
Signed-off-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
parent d8dd1578
...@@ -2086,6 +2086,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, ...@@ -2086,6 +2086,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
return -EINVAL; return -EINVAL;
if (copy_from_user(&sp->autoclose, optval, optlen)) if (copy_from_user(&sp->autoclose, optval, optlen))
return -EFAULT; return -EFAULT;
/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment