Author: adrian
Date: Mon Aug 27 23:18:41 2012
New Revision: 239760
URL: http://svn.freebsd.org/changeset/base/239760

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

Modified:
  head/sys/dev/wtap/if_wtap.c

Modified: head/sys/dev/wtap/if_wtap.c
==============================================================================
--- head/sys/dev/wtap/if_wtap.c Mon Aug 27 21:59:52 2012        (r239759)
+++ head/sys/dev/wtap/if_wtap.c Mon Aug 27 23:18:41 2012        (r239760)
@@ -268,7 +268,7 @@ wtap_newstate(struct ieee80211vap *vap, 
 
        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, 
 
        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, 
        } 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,
         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 *)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;
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to