Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 2014 01:35:24 +0000 (UTC)
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r262594 - stable/9/sys/dev/usb/net
Message-ID:  <201402280135.s1S1ZOpS001821@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rodrigc
Date: Fri Feb 28 01:35:24 2014
New Revision: 262594
URL: http://svnweb.freebsd.org/changeset/base/262594

Log:
  MFC r262142:
  
     In ue_attach_post_task(), initialize curvnet to vnet0 before calling if_attach().
     Before this patch, curvnet was NULL.
     When the VIMAGE kernel option is enabled, this eliminates
     kernel panics when USB ethernet devices are plugged in.
  
  PR: 183835
  Submitted by: Hiroo Oono <hiroo.ono at gmail dot com>

Modified:
  stable/9/sys/dev/usb/net/usb_ethernet.c
Directory Properties:
  stable/9/   (props changed)

Modified: stable/9/sys/dev/usb/net/usb_ethernet.c
==============================================================================
--- stable/9/sys/dev/usb/net/usb_ethernet.c	Fri Feb 28 01:33:03 2014	(r262593)
+++ stable/9/sys/dev/usb/net/usb_ethernet.c	Fri Feb 28 01:35:24 2014	(r262594)
@@ -207,6 +207,7 @@ ue_attach_post_task(struct usb_proc_msg 
 	sysctl_ctx_init(&ue->ue_sysctl_ctx);
 
 	error = 0;
+	CURVNET_SET_QUIET(vnet0);
 	ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
 		device_printf(ue->ue_dev, "could not allocate ifnet\n");
@@ -254,6 +255,8 @@ ue_attach_post_task(struct usb_proc_msg 
 	if (ifp->if_capabilities & IFCAP_VLAN_MTU)
 		ifp->if_hdrlen = sizeof(struct ether_vlan_header);
 
+	CURVNET_RESTORE();
+
 	snprintf(num, sizeof(num), "%u", ue->ue_unit);
 	ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx,
 	    &SYSCTL_NODE_CHILDREN(_net, ue),
@@ -267,6 +270,7 @@ ue_attach_post_task(struct usb_proc_msg 
 	return;
 
 fail:
+	CURVNET_RESTORE();
 	free_unr(ueunit, ue->ue_unit);
 	if (ue->ue_ifp != NULL) {
 		if_free(ue->ue_ifp);



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