From 9a1d0cf68f99ec2d51b91ef09e40d3bdab8f2bc3 Mon Sep 17 00:00:00 2001 From: Peter Holm Date: Sat, 3 Dec 2011 12:35:13 +0000 Subject: [PATCH] Use umtx_copyin_timeout() to copy and check timeout parameter. In collaboration with: kib MFC after: 1 week --- sys/kern/kern_thr.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index 881fd55053d6..5bcef043222c 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -450,8 +450,7 @@ sys_thr_suspend(struct thread *td, struct thr_suspend_args *uap) tsp = NULL; if (uap->timeout != NULL) { - error = copyin((const void *)uap->timeout, (void *)&ts, - sizeof(struct timespec)); + error = umtx_copyin_timeout(uap->timeout, &ts); if (error != 0) return (error); tsp = &ts; @@ -474,9 +473,6 @@ kern_thr_suspend(struct thread *td, struct timespec *tsp) } if (tsp != NULL) { - if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || - tsp->tv_nsec > 1000000000) - return (EINVAL); if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) error = EWOULDBLOCK; else {