summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2004-07-21 07:12:24 +0000
committeralfred <alfred@FreeBSD.org>2004-07-21 07:12:24 +0000
commit53db4c36fadd491dbf171e8e3614b182fc130ced (patch)
tree09085bbe2d70870f8c8c9bfc9db7ecd09a460b36 /sys/kern/uipc_mbuf.c
parentbe4d9dd8f3f7b0d6f5f89e8a9381a447de73bec5 (diff)
downloadFreeBSD-src-53db4c36fadd491dbf171e8e3614b182fc130ced.zip
FreeBSD-src-53db4c36fadd491dbf171e8e3614b182fc130ced.tar.gz
Make sure we don't call mbuf allocation functions with mutexes held.
Discussed with: rwatson
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 339e05d..a9a93fd 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -105,6 +105,7 @@ m_getm(struct mbuf *m, int len, int how, short type)
int i;
KASSERT(len >= 0, ("m_getm(): len is < 0"));
+ MBUF_CHECKSLEEP(how);
/* If m != NULL, we will append to the end of that chain. */
if (m != NULL)
@@ -307,6 +308,7 @@ m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how)
/* Note: with MAC, this may not be a good assertion. */
KASSERT(SLIST_EMPTY(&to->m_pkthdr.tags), ("m_dup_pkthdr: to has tags"));
#endif
+ MBUF_CHECKSLEEP(how);
#ifdef MAC
if (to->m_flags & M_PKTHDR)
m_tag_delete_chain(to, NULL);
@@ -329,6 +331,7 @@ m_prepend(struct mbuf *m, int len, int how)
{
struct mbuf *mn;
+ MBUF_CHECKSLEEP(how);
if (m->m_flags & M_PKTHDR)
MGETHDR(mn, how, m->m_type);
else
@@ -364,6 +367,7 @@ m_copym(struct mbuf *m, int off0, int len, int wait)
KASSERT(off >= 0, ("m_copym, negative off %d", off));
KASSERT(len >= 0, ("m_copym, negative len %d", len));
+ MBUF_CHECKSLEEP(wait);
if (off == 0 && m->m_flags & M_PKTHDR)
copyhdr = 1;
while (off > 0) {
@@ -436,6 +440,7 @@ m_copypacket(struct mbuf *m, int how)
{
struct mbuf *top, *n, *o;
+ MBUF_CHECKSLEEP(how);
MGET(n, how, m->m_type);
top = n;
if (n == NULL)
@@ -522,6 +527,7 @@ m_dup(struct mbuf *m, int how)
struct mbuf **p, *top = NULL;
int remain, moff, nsize;
+ MBUF_CHECKSLEEP(how);
/* Sanity check */
if (m == NULL)
return (NULL);
@@ -760,6 +766,7 @@ m_split(struct mbuf *m0, int len0, int wait)
struct mbuf *m, *n;
u_int len = len0, remain;
+ MBUF_CHECKSLEEP(wait);
for (m = m0; m && len > m->m_len; m = m->m_next)
len -= m->m_len;
if (m == NULL)
@@ -1049,6 +1056,7 @@ m_defrag(struct mbuf *m0, int how)
struct mbuf *m_new = NULL, *m_final = NULL;
int progress = 0, length;
+ MBUF_CHECKSLEEP(how);
if (!(m0->m_flags & M_PKTHDR))
return (m0);
OpenPOWER on IntegriCloud