1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Don't grab an unreferenced pointer to the VAP bss node.

This commit is contained in:
Adrian Chadd 2012-08-27 23:18:41 +00:00
parent 90885c6618
commit a1d97d2e9d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239760

View File

@ -268,7 +268,7 @@ wtap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
DWTAP_PRINTF("%s\n", __func__);
ni = vap->iv_bss;
ni = ieee80211_ref_node(vap->iv_bss);
/*
* Invoke the parent method to do net80211 work.
*/
@ -278,7 +278,8 @@ wtap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
if (nstate == IEEE80211_S_RUN) {
/* NB: collect bss node again, it may have changed */
ni = vap->iv_bss;
ieee80211_free_node(ni);
ni = ieee80211_ref_node(vap->iv_bss);
switch (vap->iv_opmode) {
case IEEE80211_M_MBSS:
error = wtap_beacon_alloc(sc, ni);
@ -294,9 +295,11 @@ wtap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
} else if (nstate == IEEE80211_S_INIT) {
callout_stop(&avp->av_swba);
}
ieee80211_free_node(ni);
return 0;
bad:
printf("%s: bad\n", __func__);
ieee80211_free_node(ni);
return error;
}
@ -319,6 +322,7 @@ wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
struct ieee80211vap *vap;
struct wtap_vap *avp;
int error;
struct ieee80211_node *ni;
DWTAP_PRINTF("%s\n", __func__);
@ -347,7 +351,9 @@ wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
(const char *)ic->ic_ifp->if_xname);
/* TODO this is a hack to force it to choose the rate we want */
vap->iv_bss->ni_txrate = 130;
ni = ieee80211_ref_node(vap->iv_bss);
ni->ni_txrate = 130;
ieee80211_free_node(ni);
return vap;
}