From f7fc034d213ec17f1051950b8c6e9701ef31959e Mon Sep 17 00:00:00 2001 From: weongyo Date: Fri, 30 May 2008 07:17:51 +0000 Subject: Fix a panic that it's occurred when NDIS init handler returned a error by unknown reasons. In this case, sc->ifp is still NULL so it will cause a page fault during calling ndis_detach() --- sys/dev/if_ndis/if_ndis.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sys/dev/if_ndis') diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index 692473f..1329965 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -996,15 +996,18 @@ ndis_detach(dev) sc = device_get_softc(dev); NDIS_LOCK(sc); ifp = sc->ifp; - ifp->if_flags &= ~IFF_UP; + if (ifp != NULL) + ifp->if_flags &= ~IFF_UP; if (device_is_attached(dev)) { NDIS_UNLOCK(sc); ndis_stop(sc); - if (sc->ndis_80211) - ieee80211_ifdetach(ifp->if_l2com); - else - ether_ifdetach(ifp); + if (ifp != NULL) { + if (sc->ndis_80211) + ieee80211_ifdetach(ifp->if_l2com); + else + ether_ifdetach(ifp); + } } else NDIS_UNLOCK(sc); -- cgit v1.1