aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/sock.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 22183c2ef284..7e51d3a5e4f6 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -206,7 +206,19 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
206 return -EINVAL; 206 return -EINVAL;
207 if (copy_from_user(&tv, optval, sizeof(tv))) 207 if (copy_from_user(&tv, optval, sizeof(tv)))
208 return -EFAULT; 208 return -EFAULT;
209 209 if (tv.tv_usec < 0 || tv.tv_usec >= USEC_PER_SEC)
210 return -EDOM;
211
212 if (tv.tv_sec < 0) {
213 static int warned = 0;
214 *timeo_p = 0;
215 if (warned < 10 && net_ratelimit())
216 warned++;
217 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
218 "tries to set negative timeout\n",
219 current->comm, current->pid);
220 return 0;
221 }
210 *timeo_p = MAX_SCHEDULE_TIMEOUT; 222 *timeo_p = MAX_SCHEDULE_TIMEOUT;
211 if (tv.tv_sec == 0 && tv.tv_usec == 0) 223 if (tv.tv_sec == 0 && tv.tv_usec == 0)
212 return 0; 224 return 0;