Author: adrian
Date: Sat Dec  8 09:48:03 2012
New Revision: 244025
URL: http://svnweb.freebsd.org/changeset/base/244025

Log:
  Fix a use-after-free bug in the Atheros fast-frames support.
  
  Tested:
  
  * AR5212 AP, AR5413 STA, iperf TCP STA->AP, destroyed and/or shutdown
    the STA vap during active iperf TCP traffic.
  
  PR:           kern/174273
  MFC after:    1 week

Modified:
  head/sys/net80211/ieee80211_superg.c

Modified: head/sys/net80211/ieee80211_superg.c
==============================================================================
--- head/sys/net80211/ieee80211_superg.c        Sat Dec  8 09:23:05 2012        
(r244024)
+++ head/sys/net80211/ieee80211_superg.c        Sat Dec  8 09:48:03 2012        
(r244025)
@@ -784,7 +784,7 @@ ieee80211_ff_node_cleanup(struct ieee802
        struct ieee80211com *ic = ni->ni_ic;
        struct ieee80211_superg *sg = ic->ic_superg;
        struct ieee80211_tx_ampdu *tap;
-       struct mbuf *m, *head;
+       struct mbuf *m, *next_m, *head;
        int tid;
 
        IEEE80211_LOCK(ic);
@@ -803,9 +803,16 @@ ieee80211_ff_node_cleanup(struct ieee802
        }
        IEEE80211_UNLOCK(ic);
 
-       for (m = head; m != NULL; m = m->m_nextpkt) {
+       /*
+        * Free mbufs, taking care to not dereference the mbuf after
+        * we free it (hence grabbing m_nextpkt before we free it.)
+        */
+       m = head;
+       while (m != NULL) {
+               next_m = m->m_nextpkt;
                m_freem(m);
                ieee80211_free_node(ni);
+               m = next_m;
        }
 }
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to