summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorCan Erkin Acar <canacar@cvs.openbsd.org>2009-09-21 16:33:43 +0000
committerCan Erkin Acar <canacar@cvs.openbsd.org>2009-09-21 16:33:43 +0000
commit7dfcbed9b6b1886396c0215dfa0469640833e1a5 (patch)
tree2e1682d2683c687b8f926950f70db607a292f50c /sys
parenta0fa551cc35a9e319156ba2edb76ba14c590e83b (diff)
Properly reference count bpf descriptors when using kqueue.
Reported and fix tested by weerd@, ok claudio@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bpf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 5caa8b9473a..f6f7e6c7122 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.72 2009/09/07 23:47:51 deraadt Exp $ */
+/* $OpenBSD: bpf.c,v 1.73 2009/09/21 16:33:42 canacar Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -1070,6 +1070,7 @@ bpfkqfilter(dev_t dev, struct knote *kn)
kn->kn_hook = (caddr_t)((u_long)dev);
s = splnet();
+ D_GET(d);
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
splx(s);
@@ -1086,6 +1087,7 @@ filt_bpfrdetach(struct knote *kn)
d = bpfilter_lookup(minor(dev));
s = splnet();
SLIST_REMOVE(&d->bd_sel.si_note, kn, knote, kn_selnext);
+ D_PUT(d);
splx(s);
}