netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] sctp: fix incorrect overflow check on autoclose
@ 2011-12-09  1:24 Xi Wang
  2011-12-09 17:38 ` Vladislav Yasevich
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Xi Wang @ 2011-12-09  1:24 UTC (permalink / raw)
  To: netdev
  Cc: linux-sctp, Xi Wang, Andrew Morton, Andrei Pelinescu-Onciul,
	Vlad Yasevich, David S. Miller

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);
 
 	return 0;
 }
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-01-03 15:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09  1:24 [PATCH RESEND] sctp: fix incorrect overflow check on autoclose Xi Wang
2011-12-09 17:38 ` Vladislav Yasevich
2011-12-09 18:04   ` Xi Wang
2011-12-12 22:18     ` Vladislav Yasevich
2011-12-13 22:00       ` Xi Wang
2011-12-13 22:15         ` Vladislav Yasevich
2011-12-14 21:35           ` Xi Wang
2011-12-14 21:48 ` [PATCH v2] " Xi Wang
2011-12-15 21:07   ` Vlad Yasevich
2011-12-15 22:13     ` Xi Wang
2011-12-16 13:00       ` Vlad Yasevich
2011-12-16 22:25         ` Xi Wang
2011-12-16 22:44 ` [PATCH v3] " Xi Wang
2012-01-03 15:52   ` Vladislav Yasevich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).