Re: [Lksctp-developers] [PATCH 3/3] sctp: limit maximum autoclose setsockopt value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Andrei Pelinescu-Onciul wrote:
> 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 <andrei@xxxxxxxxx>
> ---
>  net/sctp/socket.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 971890d..2f55723 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -2072,6 +2072,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;
>  }


Makes sense.  Queued to net-next.

-vlad
--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux