summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-05-28 14:34:41 +0000
committerrwatson <rwatson@FreeBSD.org>2005-05-28 14:34:41 +0000
commitf1dfea9d61c2c2818049ccdf32ad4394d1e457d0 (patch)
treefba04bb5cba4d730ef667d01d5d45f5b2fe5659e
parent23e73a4303a6e147663d73b99e11671a3c4b68b5 (diff)
downloadFreeBSD-src-f1dfea9d61c2c2818049ccdf32ad4394d1e457d0.zip
FreeBSD-src-f1dfea9d61c2c2818049ccdf32ad4394d1e457d0.tar.gz
Explicitly acquire Giant around the ntp_gettime() and assert it in the
sysctl path. While this code is close to MPSAFE, it may require some additional locking. Mark ntp_gettime1() as GIANT_REQUIRED for now. Suggested by: phk
-rw-r--r--sys/kern/kern_ntptime.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index bddbc3b..53deb9f 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -203,6 +203,8 @@ ntp_gettime1(struct ntptimeval *ntvp)
{
struct timespec atv; /* nanosecond time */
+ GIANT_REQUIRED;
+
nanotime(&atv);
ntvp->time.tv_sec = atv.tv_sec;
ntvp->time.tv_nsec = atv.tv_nsec;
@@ -261,7 +263,9 @@ ntp_gettime(struct thread *td, struct ntp_gettime_args *uap)
{
struct ntptimeval ntv;
+ mtx_lock(&Giant);
ntp_gettime1(&ntv);
+ mtx_unlock(&Giant);
return (copyout(&ntv, uap->ntvp, sizeof(ntv)));
}
OpenPOWER on IntegriCloud