On Thu, Aug 03, 2017 at 01:37:48PM +0100, Laurence Tratt wrote:
> On Wed, Aug 02, 2017 at 08:13:16PM +0200, Stefan Sperling wrote:
>
> Hello Stefan,
>
> > This is a driver bug. It looks like a race between code which resets the
> > device and code which acts upon frames received from the AP.
> > A proper fix is still in progress, but for now this is the best
> > fix/workaround I can offer:
>
> Thanks for this! It definitely made things last longer before it died, but it
> died (I think elsewhere) after a couple of hours. Please find attached a
> (bad) screenshot (the office I'm in is drowned in sunlight today!).
>
>
> Laurie
Perhaps this works better?
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.204
diff -u -p -r1.204 if_iwm.c
--- if_iwm.c 23 Jul 2017 13:51:11 -0000 1.204
+++ if_iwm.c 3 Aug 2017 19:25:38 -0000
@@ -5859,6 +5859,7 @@ iwm_newstate_task(void *psc)
enum ieee80211_state ostate = ic->ic_state;
int arg = sc->ns_arg;
int err = 0, s = splnet();
+ int generation = sc->sc_generation;
DPRINTF(("switching state %s->%s\n",
ieee80211_state_name[ostate],
@@ -5869,6 +5870,12 @@ iwm_newstate_task(void *psc)
return;
}
+ /* XXX Avoid invalid transition due to race conditions. */
+ if (ostate == IEEE80211_S_INIT && nstate > IEEE80211_S_SCAN) {
+ splx(s);
+ return;
+ }
+
if (ostate == IEEE80211_S_SCAN)
iwm_led_blink_stop(sc);
@@ -5927,7 +5934,7 @@ iwm_newstate_task(void *psc)
}
out:
- if (err == 0)
+ if (err == 0 && generation == sc->sc_generation)
sc->sc_newstate(ic, nstate, arg);
splx(s);
}