Skip to contentSkip to conversation

sctp: fix incorrect overflow check on autoclose

PATCH Superseded Xi Wang 2 participants 3 messages Dec 8, 2011 – Dec 9, 2011

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xi Wang

author
#0 lore raw

PATCH 1/1 sctp: fix incorrect overflow check on autoclose

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.

CC Andrew Morton <[email protected]>
Cc Andrei Pelinescu-Onciul <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc David S. Miller <[email protected]>
---
 net/sctp/socket.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/sctp/socket.c +2 -1
index 13bf5fc..bb91281 100644
@@ -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;
 }
Signature · 1 line
1.7.5.4
maintainer
#1 lore raw

From: Xi Wang <[email protected]>
Date: Thu, 8 Dec 2011 04:09:10 -0500

Quoted 10 lines

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.

CC Andrew Morton <[email protected]>
Cc Andrei Pelinescu-Onciul <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc David S. Miller <[email protected]>

If you actually want me to apply this you absolutely must post it, in it's entirety, to netdev.

author
#2 lore raw
In reply to Xi Wang
Quoted 2 lines · David Miller

If you actually want me to apply this you absolutely must post it, in it's entirety, to netdev.

okay will do that. thanks. ;-)

- xi