Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Panic in m_copypacket if no header is ...



details:   https://anonhg.NetBSD.org/src/rev/80843e2458de
branches:  trunk
changeset: 318492:80843e2458de
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Apr 27 06:15:49 2018 +0000
description:
Panic in m_copypacket if no header is present, that's a requirement.

diffstat:

 sys/kern/uipc_mbuf.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 94b699f949c2 -r 80843e2458de sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Fri Apr 27 06:06:43 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Fri Apr 27 06:15:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.197 2018/04/26 19:13:34 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.198 2018/04/27 06:15:49 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.197 2018/04/26 19:13:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.198 2018/04/27 06:15:49 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -836,6 +836,10 @@
 {
        struct mbuf *top, *n, *o;
 
+       if (__predict_false((m->m_flags & M_PKTHDR) == 0)) {
+               panic("%s: no header (m = %p)", __func__, m);
+       }
+
        n = m_get(how, m->m_type);
        top = n;
        if (!n)



Home | Main Index | Thread Index | Old Index