aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2003-02-03 14:47:22 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2003-02-03 14:47:22 +0000
commit411c25edaea6d45669dfaca9b8a7c30f57cc0cb8 (patch)
treeb7f01039f2c95629f233eeda77ed9073333440ab
parent83536948aeda24c5e4389f4e69de5b5bb917ba30 (diff)
downloadsrc-411c25edaea6d45669dfaca9b8a7c30f57cc0cb8.tar.gz
src-411c25edaea6d45669dfaca9b8a7c30f57cc0cb8.zip
Avoid holding Giant across copyout() in gettimeofday() and getitimer().
Notes
Notes: svn path=/head/; revision=110286
-rw-r--r--sys/kern/kern_time.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index df0a0cf4a8bf..f778c4c1e66a 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -321,6 +321,7 @@ int
gettimeofday(struct thread *td, struct gettimeofday_args *uap)
{
struct timeval atv;
+ struct timezone rtz;
int error = 0;
if (uap->tp) {
@@ -329,8 +330,9 @@ gettimeofday(struct thread *td, struct gettimeofday_args *uap)
}
if (error == 0 && uap->tzp != NULL) {
mtx_lock(&Giant);
- error = copyout(&tz, uap->tzp, sizeof (tz));
+ rtz = tz;
mtx_unlock(&Giant);
+ error = copyout(&rtz, uap->tzp, sizeof (rtz));
}
return (error);
}
@@ -417,7 +419,6 @@ getitimer(struct thread *td, struct getitimer_args *uap)
struct timeval ctv;
struct itimerval aitv;
int s;
- int error;
if (uap->which > ITIMER_PROF)
return (EINVAL);
@@ -444,9 +445,8 @@ getitimer(struct thread *td, struct getitimer_args *uap)
aitv = p->p_stats->p_timer[uap->which];
}
splx(s);
- error = copyout(&aitv, uap->itv, sizeof (struct itimerval));
mtx_unlock(&Giant);
- return(error);
+ return (copyout(&aitv, uap->itv, sizeof (struct itimerval)));
}
#ifndef _SYS_SYSPROTO_H_