On Mon, Feb 04, 2013 at 09:41:32AM +0200, 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 <nde...@gmail.com> (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)?

Thanks, I can confirm that this one works too.

> 
> 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;
> 
>       /*
>        * Just return if it's a new interface without an ng_ether companion.
>        */
> +     node = IFP2NG(ifp);
>       if (node == NULL)
>               return;
> 
> 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to