From 11a33202874e445f31cae303d6a80f0d83f417bc Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 14 Oct 2003 05:25:31 +0000 Subject: [PATCH] Fix a race condition in owi. If you eject a card, then the wi_inquire timeout would continue to happen: boom! Fix this[*] by timing out earlier. [*] almost fixes the race on unload: wi_inquire could be running when untimeout is called, and there's no way to know when it has actually returned. This race is very rare and hard to lose. Submitted by: scottl --- sys/dev/owi/if_owi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/owi/if_owi.c b/sys/dev/owi/if_owi.c index 3092a61f3156..70f1941b323a 100644 --- a/sys/dev/owi/if_owi.c +++ b/sys/dev/owi/if_owi.c @@ -1901,6 +1901,8 @@ owi_stop(sc) WI_LOCK(sc, s); + untimeout(wi_inquire, sc, sc->wi_stat_ch); + if (sc->wi_gone) { WI_UNLOCK(sc, s); return; @@ -1918,8 +1920,6 @@ owi_stop(sc) wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0, 0, 0); } - untimeout(wi_inquire, sc, sc->wi_stat_ch); - ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); WI_UNLOCK(sc, s);