From owner-svn-src-all@FreeBSD.ORG Mon Feb 4 08:29:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EB99DA9E; Mon, 4 Feb 2013 08:29:02 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) by mx1.freebsd.org (Postfix) with ESMTP id 32F6D25F; Mon, 4 Feb 2013 08:29:01 +0000 (UTC) Received: from sluga.fer.hr (161.53.72.14) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server id 14.1.438.0; Mon, 4 Feb 2013 09:27:47 +0100 Received: from localhost ([161.53.19.63]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Feb 2013 09:27:47 +0100 From: Marko Zec To: Andriy Gapon Subject: Re: svn commit: r246245 - head/sys/netgraph Date: Mon, 4 Feb 2013 09:27:43 +0100 User-Agent: KMail/1.9.10 References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <20130204003701.GA1700@oddish> <510F662C.1080007@FreeBSD.org> In-Reply-To: <510F662C.1080007@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <201302040927.43559.zec@fer.hr> X-OriginalArrivalTime: 04 Feb 2013 08:27:47.0835 (UTC) FILETIME=[83762CB0:01CE02B1] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mark Johnston , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 08:29:03 -0000 On Monday 04 February 2013 08:41:32 Andriy Gapon wrote: > on 04/02/2013 02:37 Mark Johnston said the following: > > On Sat, Feb 02, 2013 at 11:54:00AM +0000, Andriy Gapon wrote: > >> Author: avg > >> Date: Sat Feb 2 11:54:00 2013 > >> New Revision: 246245 > >> URL: http://svnweb.freebsd.org/changeset/base/246245 > >> > >> Log: > >> ng_ether: track interface renaming > >> > >> Also sanitize interface names that can potentially contain > >> characters that are prohibited in netgraph names. > >> > >> PR: kern/154850 (sanitizing of names) > >> Discussed with: eri, melifaro > >> Submitted by: Nikolay Denev (sanitizing code) > >> Reviewed by: eri, glebius > >> MFC after: 17 days > >> > >> Modified: > >> head/sys/netgraph/ng_ether.c > > > > Hi Andriy, > > > > This commit seems to cause a panic during boot when creating the > > loopback interface. I couldn't get a core dump but the problem seems to > > happen when dereferencing ifp->if_l2com in the IFP2NG macro in > > ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems > > to be NULL (I suppose because lo(4) doesn't register itself in the > > if_com_alloc/free tables). > > > > The patch below fixes the panic for me. > > Mark, > > thank you for the report and sorry for the breakage. > Could you please try the following patch (slightly different from your > patch)? > > diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c > index 6266f40..05ea402 100644 > --- a/sys/netgraph/ng_ether.c > +++ b/sys/netgraph/ng_ether.c > @@ -410,11 +410,16 @@ static void > ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) > { > char name[IFNAMSIZ]; > - node_p node = IFP2NG(ifp); > + node_p node; > + > + /* Only ethernet interfaces are of interest. */ > + if (ifp->if_type != IFT_ETHER) > + return; And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211? Marko > /* > * Just return if it's a new interface without an ng_ether companion. > */ > + node = IFP2NG(ifp); > if (node == NULL) > return; > > > diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c > > index 6266f40..f566346 100644 > > --- a/sys/netgraph/ng_ether.c > > +++ b/sys/netgraph/ng_ether.c > > @@ -410,7 +410,12 @@ static void > > ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) > > { > > char name[IFNAMSIZ]; > > - node_p node = IFP2NG(ifp); > > + node_p node; > > + > > + if (ifp->if_l2com == NULL) > > + return; > > + > > + node = IFP2NG(ifp); > > > > /* > > * Just return if it's a new interface without an ng_ether companion.