All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladislav Yasevich <vladislav.yasevich@hp.com>
To: Xi Wang <xi.wang@gmail.com>
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrei Pelinescu-Onciul <andrei@iptel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH RESEND] sctp: fix incorrect overflow check on autoclose
Date: Fri, 09 Dec 2011 17:38:19 +0000	[thread overview]
Message-ID: <4EE2478B.5010409@hp.com> (raw)
In-Reply-To: <1323393883-3759-1-git-send-email-xi.wang@gmail.com>

On 12/08/2011 08:24 PM, Xi Wang wrote:
> The commit 8ffd3208 voids the previous patches f6778aab and 810c0719
> for limiting the maximum autoclose value.  If userspace passes in -1
> on 32-bit platform, the overflow check didn't work and autoclose
> would be set to 0xffffffff.
> 
> Signed-off-by: Xi Wang <xi.wang@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andrei Pelinescu-Onciul <andrei@iptel.org>
> Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  net/sctp/socket.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 13bf5fc..bb91281 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -2201,7 +2201,8 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
>  	if (copy_from_user(&sp->autoclose, optval, optlen))
>  		return -EFAULT;
>  	/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
> -	sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ);
> +	sp->autoclose = min_t(unsigned long, sp->autoclose,
> +			      MAX_SCHEDULE_TIMEOUT / HZ);

I think this should be u32 since that's what sp->autoclose is.

-vlad

>  
>  	return 0;
>  }


WARNING: multiple messages have this Message-ID (diff)
From: Vladislav Yasevich <vladislav.yasevich@hp.com>
To: Xi Wang <xi.wang@gmail.com>
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrei Pelinescu-Onciul <andrei@iptel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH RESEND] sctp: fix incorrect overflow check on autoclose
Date: Fri, 09 Dec 2011 12:38:19 -0500	[thread overview]
Message-ID: <4EE2478B.5010409@hp.com> (raw)
In-Reply-To: <1323393883-3759-1-git-send-email-xi.wang@gmail.com>

On 12/08/2011 08:24 PM, Xi Wang wrote:
> The commit 8ffd3208 voids the previous patches f6778aab and 810c0719
> for limiting the maximum autoclose value.  If userspace passes in -1
> on 32-bit platform, the overflow check didn't work and autoclose
> would be set to 0xffffffff.
> 
> Signed-off-by: Xi Wang <xi.wang@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andrei Pelinescu-Onciul <andrei@iptel.org>
> Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  net/sctp/socket.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 13bf5fc..bb91281 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -2201,7 +2201,8 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
>  	if (copy_from_user(&sp->autoclose, optval, optlen))
>  		return -EFAULT;
>  	/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
> -	sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ);
> +	sp->autoclose = min_t(unsigned long, sp->autoclose,
> +			      MAX_SCHEDULE_TIMEOUT / HZ);

I think this should be u32 since that's what sp->autoclose is.

-vlad

>  
>  	return 0;
>  }

  reply	other threads:[~2011-12-09 17:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09  1:24 [PATCH RESEND] sctp: fix incorrect overflow check on autoclose Xi Wang
2011-12-09  1:24 ` Xi Wang
2011-12-09 17:38 ` Vladislav Yasevich [this message]
2011-12-09 17:38   ` Vladislav Yasevich
2011-12-09 18:04   ` Xi Wang
2011-12-09 18:04     ` Xi Wang
2011-12-12 22:18     ` Vladislav Yasevich
2011-12-12 22:18       ` Vladislav Yasevich
2011-12-13 22:00       ` Xi Wang
2011-12-13 22:00         ` Xi Wang
2011-12-13 22:15         ` Vladislav Yasevich
2011-12-13 22:15           ` Vladislav Yasevich
2011-12-14 21:35           ` Xi Wang
2011-12-14 21:35             ` Xi Wang
2011-12-14 21:48 ` [PATCH v2] " Xi Wang
2011-12-14 21:48   ` Xi Wang
2011-12-15 21:07   ` Vlad Yasevich
2011-12-15 21:07     ` Vlad Yasevich
2011-12-15 22:13     ` Xi Wang
2011-12-15 22:13       ` Xi Wang
2011-12-16 13:00       ` Vlad Yasevich
2011-12-16 13:00         ` Vlad Yasevich
2011-12-16 22:25         ` Xi Wang
2011-12-16 22:25           ` Xi Wang
2011-12-16 22:44 ` [PATCH v3] " Xi Wang
2011-12-16 22:44   ` Xi Wang
2012-01-03 15:52   ` Vladislav Yasevich
2012-01-03 15:52     ` Vladislav Yasevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE2478B.5010409@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrei@iptel.org \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xi.wang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.