Author: rwatson
Date: Thu Apr 23 19:29:45 2009
New Revision: 191437
URL: http://svn.freebsd.org/changeset/base/191437

Log:
  Two ifnet misuse fixes for if_nve:
  
  (1) Don't manually configure if_output(), ether_ifattach() will do that
      for us as part of link-layer setup.
  
  (2) Call if_detach() before stopping nve in order to prevent calls into
      the device driver after the driver has started shutting down.
  
  Reviewed by:  jhb
  MFC after:    2 weeks

Modified:
  head/sys/dev/nve/if_nve.c

Modified: head/sys/dev/nve/if_nve.c
==============================================================================
--- head/sys/dev/nve/if_nve.c   Thu Apr 23 18:46:03 2009        (r191436)
+++ head/sys/dev/nve/if_nve.c   Thu Apr 23 19:29:45 2009        (r191437)
@@ -539,7 +539,6 @@ nve_attach(device_t dev)
        if_initname(ifp, device_get_name(dev), device_get_unit(dev));
        ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
        ifp->if_ioctl = nve_ioctl;
-       ifp->if_output = ether_output;
        ifp->if_start = nve_ifstart;
        ifp->if_watchdog = nve_watchdog;
        ifp->if_timer = 0;
@@ -585,11 +584,11 @@ nve_detach(device_t dev)
        ifp = sc->ifp;
 
        if (device_is_attached(dev)) {
+               ether_ifdetach(ifp);
                NVE_LOCK(sc);
                nve_stop(sc);
                NVE_UNLOCK(sc);
                callout_drain(&sc->stat_callout);
-               ether_ifdetach(ifp);
        }
 
        if (sc->miibus)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to