diff options
author | alfred <alfred@FreeBSD.org> | 2003-01-19 06:51:10 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2003-01-19 06:51:10 +0000 |
commit | bfacd93538115bc4ebee0191bdf7cfb18041842c (patch) | |
tree | d890b8b95d64eeeca8870bbe3a407d8d181f0d21 | |
parent | b2cf4b9bc050c2dc60962f9eccf13ce480fa8aee (diff) | |
download | FreeBSD-src-bfacd93538115bc4ebee0191bdf7cfb18041842c.zip FreeBSD-src-bfacd93538115bc4ebee0191bdf7cfb18041842c.tar.gz |
useracc() is mpsafe so we only need to hold Giant
over the call to nanosleep1()
Pointed out by: tjr
-rw-r--r-- | sys/kern/kern_time.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 2d53d3f..aaa3890 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -293,24 +293,19 @@ nanosleep(struct thread *td, struct nanosleep_args *uap) if (error) return (error); + if (uap->rmtp && + !useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE)) + return (EFAULT); mtx_lock(&Giant); - if (uap->rmtp) { - if (!useracc((caddr_t)uap->rmtp, sizeof(rmt), - VM_PROT_WRITE)) { - error = EFAULT; - goto done2; - } - } error = nanosleep1(td, &rqt, &rmt); + mtx_unlock(&Giant); if (error && uap->rmtp) { int error2; error2 = copyout(&rmt, uap->rmtp, sizeof(rmt)); - if (error2) /* XXX shouldn't happen, did useracc() above */ + if (error2) error = error2; } -done2: - mtx_unlock(&Giant); return (error); } |