Module Name:    src
Committed By:   maxv
Date:           Mon Apr  9 11:35:22 UTC 2018

Modified Files:
        src/sys/net: if_ethersubr.c

Log Message:
Add KASSERT. The input point expects struct ether_header to be there.

Now, I'm wondering whether it can be triggered by L2 encapsulation
protocols - they may not provide a contiguous area.


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/sys/net/if_ethersubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.261 src/sys/net/if_ethersubr.c:1.262
--- src/sys/net/if_ethersubr.c:1.261	Mon Apr  9 11:05:59 2018
+++ src/sys/net/if_ethersubr.c	Mon Apr  9 11:35:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.261 2018/04/09 11:05:59 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.262 2018/04/09 11:35:22 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.261 2018/04/09 11:05:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.262 2018/04/09 11:35:22 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -588,6 +588,7 @@ ether_input(struct ifnet *ifp, struct mb
 
 	KASSERT(!cpu_intr_p());
 	KASSERT((m->m_flags & M_PKTHDR) != 0);
+	KASSERT(m->m_len >= sizeof(*eh));
 
 	if ((ifp->if_flags & IFF_UP) == 0) {
 		m_freem(m);

Reply via email to