diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2002-02-05 21:59:19 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2002-02-05 21:59:19 +0000 |
commit | 95104ca27088752350fb3d77bcdf87584451b1fa (patch) | |
tree | b69e9f07aab2c94ba81878bb5fb525514f77a381 | |
parent | 344daa2a66b00732eade42d698b46b79a93d8c71 (diff) |
panic if a read-only mbuf is given to m_zero() --- from art@openbsd.org
-rw-r--r-- | sys/kern/uipc_mbuf.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 469cee8874b..e10eacee3f8 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.52 2002/02/05 21:47:59 angelos Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.53 2002/02/05 21:59:18 angelos Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -901,9 +901,12 @@ m_zero(m) struct mbuf *m; { while (m) { +#ifdef DIAGNOSTIC + if (M_READONLY(m)) + panic("m_zero: M_READONLY"); +#endif /* DIAGNOSTIC */ if ((m->m_flags & M_EXT) && - (m->m_ext.ext_free == NULL) && - !MCLISREFERENCED(m)) + (m->m_ext.ext_free == NULL)) memset(m->m_ext.ext_buf, 0, m->m_ext.ext_size); else { if (m->m_flags & M_PKTHDR) |