From 530ee5c971d868328381cdc1339dba6ccbf8a7df Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Thu, 23 Apr 2009 19:29:45 +0000 Subject: [PATCH] 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 --- sys/dev/nve/if_nve.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/nve/if_nve.c b/sys/dev/nve/if_nve.c index a0746c1c97e..c4f8710defe 100644 --- a/sys/dev/nve/if_nve.c +++ b/sys/dev/nve/if_nve.c @@ -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)