summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2004-05-03 00:48:11 +0000
committercperciva <cperciva@FreeBSD.org>2004-05-03 00:48:11 +0000
commitfe4e3a8b16f53102ecc8d38bc34da4d3b8b103c8 (patch)
tree357e06781027d7bd0973797fe3930923f5872b44 /sys/kern/kern_clock.c
parentc219e5f35aa02954b3817364961431b5f497bb9f (diff)
downloadFreeBSD-src-fe4e3a8b16f53102ecc8d38bc34da4d3b8b103c8.zip
FreeBSD-src-fe4e3a8b16f53102ecc8d38bc34da4d3b8b103c8.tar.gz
Fix a race condition which could result in profprocs being decremented
more than once if stopprofclock is called multiple times on the same process.
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r--sys/kern/kern_clock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 0661c61..a4485a4 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -353,6 +353,8 @@ stopprofclock(p)
"stopprof", 0);
p->p_flag &= ~P_STOPPROF;
}
+ if ((p->p_flag & P_PROFIL) == 0)
+ return;
mtx_lock_spin(&sched_lock);
p->p_flag &= ~P_PROFIL;
if (--profprocs == 0)
OpenPOWER on IntegriCloud