summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-08-09 16:19:09 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-08-09 16:19:09 +0000
commit534d66cc66bf7453f06391910532a2c5803d383e (patch)
treec04e698ca7f82593e8d699faac7898335a1312d7 /sys/kern
parent0a8733e2c07ec517a3f0b7dc980eb6a001455da6 (diff)
use m_free_unlocked() in m_pullup() to avoid iterative splnet/splx down
the chain ok henning
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_mbuf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 77832fc86fb..43cefb08330 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.126 2009/08/09 12:50:09 henning Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.127 2009/08/09 16:19:08 deraadt Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -924,6 +924,7 @@ m_pullup(struct mbuf *n, int len)
struct mbuf *m;
int count;
int space;
+ int s;
/*
* If first mbuf has no cluster, and has room for len bytes
@@ -948,6 +949,7 @@ m_pullup(struct mbuf *n, int len)
M_MOVE_PKTHDR(m, n);
}
space = &m->m_dat[MLEN] - (m->m_data + m->m_len);
+ s = splnet();
do {
count = min(min(max(len, max_protohdr), space), n->m_len);
bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len,
@@ -959,12 +961,14 @@ m_pullup(struct mbuf *n, int len)
if (n->m_len)
n->m_data += count;
else
- n = m_free(n);
+ n = m_free_unlocked(n);
} while (len > 0 && n);
if (len > 0) {
- (void)m_free(m);
+ (void)m_free_unlocked(m);
+ splx(s);
goto bad;
}
+ splx(s);
m->m_next = n;
return (m);
bad: