mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-16 23:20:03 +01:00
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: Andrei Pelinescu-Onciul <[email protected]> Signed-off-by: Vlad Yasevich <[email protected]>
This commit is contained in:
1 parent
d8dd15781d
commit
f6778aab6c
1 file changed
+3
@@ -2086,6 +2086,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&sp->autoclose, optval, optlen))
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user