From 060b3e4ff14e1f6787f201b95f4a4ff0cb2a70de Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Fri, 10 Aug 2018 13:06:14 +0000 Subject: [PATCH] bwi(4): Set ic->ic_softc before bwi_getradiocaps to avoid bad deref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submitted by: François Revol Obtained from: Haiku (ba88131cfde64e21bedb4ebedd699cfa5e7fd314) MFC after: 1 week --- sys/dev/bwi/if_bwi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index cc51b3b36998..0349450652a0 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -490,10 +490,12 @@ bwi_attach(struct bwi_softc *sc) BWI_SPROM_CARD_INFO_LOCALE); DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale); /* XXX use locale */ + + ic->ic_softc = sc; + bwi_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, ic->ic_channels); - ic->ic_softc = sc; ic->ic_name = device_get_nameunit(dev); ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_SHSLOT |