aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2004-04-07 05:59:57 +0000
committerColin Percival <cperciva@FreeBSD.org>2004-04-07 05:59:57 +0000
commitec513ff7599eb52e36ce8ead8ac6e54520cbf03f (patch)
tree78f918fba8732bff5a615a751df1c1925b925e61 /sys
parentc3959ad01c0e8420da2ed953e169af48a4834897 (diff)
downloadsrc-ec513ff7599eb52e36ce8ead8ac6e54520cbf03f.tar.gz
src-ec513ff7599eb52e36ce8ead8ac6e54520cbf03f.zip
Fix filt_timer* races: Finish initializing a knote before we pass it to
a callout, and use the new callout_drain API to make sure that a callout has finished before we deallocate memory it is using. PR: kern/64121 Discussed with: gallatin
Notes
Notes: svn path=/head/; revision=127982
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_event.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 1be6383f414e..fd01413d7a9d 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -348,8 +348,8 @@ filt_timerattach(struct knote *kn)
MALLOC(calloutp, struct callout *, sizeof(*calloutp),
M_KQUEUE, M_WAITOK);
callout_init(calloutp, 0);
- callout_reset(calloutp, tticks, filt_timerexpire, kn);
kn->kn_hook = calloutp;
+ callout_reset(calloutp, tticks, filt_timerexpire, kn);
return (0);
}
@@ -360,7 +360,7 @@ filt_timerdetach(struct knote *kn)
struct callout *calloutp;
calloutp = (struct callout *)kn->kn_hook;
- callout_stop(calloutp);
+ callout_drain(calloutp);
FREE(calloutp, M_KQUEUE);
kq_ncallouts--;
}