diff options
| author | mrg <mrg@NetBSD.org> | 2020-09-15 08:33:40 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2020-09-15 08:33:40 +0000 |
| commit | ac82f4eea820e10fbbc1c64d57cc2fde20036173 (patch) | |
| tree | af3369941e06b62e02eaf6caf1ad214bbbe48b38 /sys/dev | |
| parent | 6412e2a73199c6279715fd63d6dae42a60a84d3e (diff) | |
mii_detach() must come before ifmedia_fini(), otherwise mii_detach()
will have a NULL mutex and fault.
this appears to have been introduced in february, and may be a problem
in other drivers converted to use ifmedia_fini(). i've only fixed the
two that were faulting for me on sunblade 2000 during reboot.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/gem.c | 7 | ||||
| -rw-r--r-- | sys/dev/pci/if_cas.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index edaf4365709..a61fa73fd01 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $NetBSD: gem.c,v 1.131 2020/07/15 01:42:27 msaitoh Exp $ */ +/* $NetBSD: gem.c,v 1.132 2020/09/15 08:33:40 mrg Exp $ */ /* * @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.131 2020/07/15 01:42:27 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.132 2020/09/15 08:33:40 mrg Exp $"); #include "opt_inet.h" @@ -175,7 +175,6 @@ gem_detach(struct gem_softc *sc, int flags) rnd_detach_source(&sc->rnd_source); ether_ifdetach(ifp); if_detach(ifp); - ifmedia_fini(&sc->sc_mii.mii_media); callout_destroy(&sc->sc_tick_ch); callout_destroy(&sc->sc_rx_watchdog); @@ -184,6 +183,8 @@ gem_detach(struct gem_softc *sc, int flags) case GEM_ATT_MII: sc->sc_att_stage = GEM_ATT_MII; mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); + ifmedia_fini(&sc->sc_mii.mii_media); + /*FALLTHROUGH*/ case GEM_ATT_7: for (i = 0; i < GEM_NRXDESC; i++) { diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 38205afe6e0..b8374cc9c20 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cas.c,v 1.43 2020/07/02 09:02:04 msaitoh Exp $ */ +/* $NetBSD: if_cas.c,v 1.44 2020/09/15 08:33:40 mrg Exp $ */ /* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */ /* @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.43 2020/07/02 09:02:04 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.44 2020/09/15 08:33:40 mrg Exp $"); #ifndef _MODULE #include "opt_inet.h" @@ -765,12 +765,13 @@ cas_detach(device_t self, int flags) ether_ifdetach(ifp); if_detach(ifp); - ifmedia_fini(&sc->sc_mii.mii_media); callout_destroy(&sc->sc_tick_ch); mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); + ifmedia_fini(&sc->sc_mii.mii_media); + /*FALLTHROUGH*/ case CAS_ATT_MII: case CAS_ATT_7: |
