summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/wlan/if_urtw.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2010-09-02 03:28:03 +0000
committerthompsa <thompsa@FreeBSD.org>2010-09-02 03:28:03 +0000
commit1a84f8ba2ae2f9c4b0376b200c9e1c505ea1f6e5 (patch)
tree96181ac569fa147859c67d6e8334673d021645fe /sys/dev/usb/wlan/if_urtw.c
parent5621f791d2277c43041de7701e15cbcfa9b6dd87 (diff)
downloadFreeBSD-src-1a84f8ba2ae2f9c4b0376b200c9e1c505ea1f6e5.zip
FreeBSD-src-1a84f8ba2ae2f9c4b0376b200c9e1c505ea1f6e5.tar.gz
We need to grab a node reference count to vap->iv_bss before using it as it is
possible for the node to be replaced and freed at any time by ieee80211_sta_join1().
Diffstat (limited to 'sys/dev/usb/wlan/if_urtw.c')
-rw-r--r--sys/dev/usb/wlan/if_urtw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c
index 39f1847..0236956 100644
--- a/sys/dev/usb/wlan/if_urtw.c
+++ b/sys/dev/usb/wlan/if_urtw.c
@@ -1830,7 +1830,6 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0,
static int
urtw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
{
- struct ieee80211_node *ni = vap->iv_bss;
struct ieee80211com *ic = vap->iv_ic;
struct urtw_softc *sc = ic->ic_ifp->if_softc;
struct urtw_vap *uvp = URTW_VAP(vap);
@@ -1854,6 +1853,9 @@ urtw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
case IEEE80211_S_ASSOC:
break;
case IEEE80211_S_RUN:
+ struct ieee80211_node *ni;
+
+ ni = ieee80211_ref_node(vap->iv_bss);
/* setting bssid. */
urtw_write32_m(sc, URTW_BSSID, ((uint32_t *)ni->ni_bssid)[0]);
urtw_write16_m(sc, URTW_BSSID + 4,
@@ -1868,6 +1870,7 @@ urtw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
if (error != 0)
device_printf(sc->sc_dev,
"could not control LED (%d)\n", error);
+ ieee80211_free_node(ni);
break;
default:
break;
OpenPOWER on IntegriCloud