Module Name: src Committed By: maxv Date: Mon Jan 22 10:26:38 UTC 2018
Modified Files: src/share/man/man9: mbuf.9 src/sys/kern: uipc_mbuf.c Log Message: m_prepend does not tolerate being given len > MHLEN, so add a panic, and document this behavior. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/share/man/man9/mbuf.9 cvs rdiff -u -r1.179 -r1.180 src/sys/kern/uipc_mbuf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man9/mbuf.9 diff -u src/share/man/man9/mbuf.9:1.53 src/share/man/man9/mbuf.9:1.54 --- src/share/man/man9/mbuf.9:1.53 Mon Jan 1 12:46:49 2018 +++ src/share/man/man9/mbuf.9 Mon Jan 22 10:26:38 2018 @@ -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 Index: src/sys/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.179 src/sys/kern/uipc_mbuf.c:1.180 --- src/sys/kern/uipc_mbuf.c:1.179 Mon Jan 22 09:06:40 2018 +++ src/sys/kern/uipc_mbuf.c Mon Jan 22 10:26:38 2018 @@ -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 h { 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) {