summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-12-20 22:27:39 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-12-20 22:27:39 +0000
commitf7cc3dfbdaf614aa5862b08252dc8423ec1126c6 (patch)
treeea4936e0ac8ef1d51c21d44ac8dd1d50194cabdb /sys
parent69f83572509696a67f8fb3a52e7335825a19ea67 (diff)
protect mbstat with spl; ok claudio mikeb
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_mbuf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 728e0e9c28c..412d36dba64 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.111 2008/12/14 22:31:46 kettenis Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.112 2008/12/20 22:27:38 deraadt Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -170,8 +170,8 @@ m_reclaim(void *arg, int flags)
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
if (pr->pr_drain)
(*pr->pr_drain)();
- splx(s);
mbstat.m_drain++;
+ splx(s);
}
/*
@@ -185,10 +185,11 @@ m_get(int nowait, int type)
s = splvm();
m = pool_get(&mbpool, nowait == M_WAIT ? PR_WAITOK : 0);
+ if (m)
+ mbstat.m_mtypes[type]++;
splx(s);
if (m) {
m->m_type = type;
- mbstat.m_mtypes[type]++;
m->m_next = (struct mbuf *)NULL;
m->m_nextpkt = (struct mbuf *)NULL;
m->m_data = m->m_dat;
@@ -209,10 +210,11 @@ m_gethdr(int nowait, int type)
s = splvm();
m = pool_get(&mbpool, nowait == M_WAIT ? PR_WAITOK : 0);
+ if (m)
+ mbstat.m_mtypes[type]++;
splx(s);
if (m) {
m->m_type = type;
- mbstat.m_mtypes[type]++;
/* keep in sync with m_inithdr */
m->m_next = (struct mbuf *)NULL;