m_prepend does not tolerate being given len > MHLEN, so add a panic, and
document this behavior.
This commit is contained in:
parent
35c7659d33
commit
5c9e30189d
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: mbuf.9,v 1.53 2018/01/01 12:46:49 wiz Exp $
|
||||
.\" $NetBSD: mbuf.9,v 1.54 2018/01/22 10:26:38 maxv Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 1, 2018
|
||||
.Dd January 22, 2018
|
||||
.Dt MBUF 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -431,6 +431,10 @@ The
|
|||
parameter is a choice of
|
||||
.Dv M_WAIT / M_DONTWAIT
|
||||
from caller.
|
||||
It is illegal for the
|
||||
.Fa len
|
||||
parameter to be greater than
|
||||
.Dv MHLEN .
|
||||
.It Fn m_pulldown "struct mbuf *m" "int off" "int len" "int *offp"
|
||||
Rearranges an mbuf chain so that
|
||||
.Fa len
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_mbuf.c,v 1.179 2018/01/22 09:06:40 maxv Exp $ */
|
||||
/* $NetBSD: uipc_mbuf.c,v 1.180 2018/01/22 10:26:38 maxv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.179 2018/01/22 09:06:40 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.180 2018/01/22 10:26:38 maxv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_mbuftrace.h"
|
||||
|
@ -661,6 +661,10 @@ m_prepend(struct mbuf *m, int len, int how)
|
|||
{
|
||||
struct mbuf *mn;
|
||||
|
||||
if (__predict_false(len > MHLEN)) {
|
||||
panic("%s: len > MHLEN", __func__);
|
||||
}
|
||||
|
||||
KASSERT(len != M_COPYALL);
|
||||
mn = m_get(how, m->m_type);
|
||||
if (mn == NULL) {
|
||||
|
|
Loading…
Reference in New Issue