From b62b2304616f87b607e5db36d6d1cc28759aea6e Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Mon, 3 May 2004 00:48:11 +0000 Subject: [PATCH] Fix a race condition which could result in profprocs being decremented more than once if stopprofclock is called multiple times on the same process. --- sys/kern/kern_clock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 0661c61f6e4b..a4485a448958 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)