Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 2019 16:48:23 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353934 - head/sys/net
Message-ID:  <201910231648.x9NGmNma033372@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Wed Oct 23 16:48:22 2019
New Revision: 353934
URL: https://svnweb.freebsd.org/changeset/base/353934

Log:
  Prevent a panic when a driver provides bogus debugnet parameters
  
  This is just a bandaid; we should fix the driver(s) too.  Introduced in
  r353685.
  
  PR:		241403
  X-MFC-With:	r353685
  Reported by:	np and others

Modified:
  head/sys/net/debugnet.c

Modified: head/sys/net/debugnet.c
==============================================================================
--- head/sys/net/debugnet.c	Wed Oct 23 16:48:17 2019	(r353933)
+++ head/sys/net/debugnet.c	Wed Oct 23 16:48:22 2019	(r353934)
@@ -826,6 +826,15 @@ debugnet_any_ifnet_update(struct ifnet *ifp)
 	nmbuf = ncl * (4 + nrxr);
 	ncl *= nrxr;
 
+	/*
+	 * Bandaid for drivers that (incorrectly) advertise LinkUp before their
+	 * dn_init method is available.
+	 */
+	if (nmbuf == 0 || ncl == 0 || clsize == 0) {
+		printf("%s: Bad dn_init result from %s (ifp %p), ignoring.\n",
+		    __func__, if_name(ifp), ifp);
+		return;
+	}
 	dn_maybe_reinit_mbufs(nmbuf, ncl, clsize);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910231648.x9NGmNma033372>