Author: eadler
Date: Thu Mar  1 06:55:46 2018
New Revision: 330223
URL: https://svnweb.freebsd.org/changeset/base/330223

Log:
  MFC r321508:
  
  [iwm] Cleanup mbufq draining. Add iwm_xmit_queue_drain() like in iwn(4).
  
  * iwm_xmit_queue_drain() calls ieee80211_free_node(), removing a possible
    memory leak, compared to using just mbufq_drain().
  
  * Remove duplicate mbufq_drain() from iwm_mvm_rm_sta(), this should be
    handled in the caller.

Modified:
  stable/11/sys/dev/iwm/if_iwm.c
  stable/11/sys/dev/iwm/if_iwm_sta.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iwm/if_iwm.c
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm.c      Thu Mar  1 06:54:03 2018        
(r330222)
+++ stable/11/sys/dev/iwm/if_iwm.c      Thu Mar  1 06:55:46 2018        
(r330223)
@@ -391,6 +391,7 @@ static struct ieee80211vap *
                               const uint8_t [IEEE80211_ADDR_LEN],
                               const uint8_t [IEEE80211_ADDR_LEN]);
 static void    iwm_vap_delete(struct ieee80211vap *);
+static void    iwm_xmit_queue_drain(struct iwm_softc *);
 static void    iwm_scan_start(struct ieee80211com *);
 static void    iwm_scan_end(struct ieee80211com *);
 static void    iwm_update_mcast(struct ieee80211com *);
@@ -4132,7 +4133,7 @@ iwm_release(struct iwm_softc *sc, struct iwm_node *in)
         * get here from RUN state.
         */
        tfd_msk = 0xf;
-       mbufq_drain(&sc->sc_snd);
+       iwm_xmit_queue_drain(sc);
        iwm_mvm_flush_tx_path(sc, tfd_msk, IWM_CMD_SYNC);
        /*
         * We seem to get away with just synchronously sending the
@@ -6364,6 +6365,19 @@ iwm_vap_delete(struct ieee80211vap *vap)
 }
 
 static void
+iwm_xmit_queue_drain(struct iwm_softc *sc)
+{
+       struct mbuf *m;
+       struct ieee80211_node *ni;
+
+       while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
+               ni = (struct ieee80211_node *)m->m_pkthdr.rcvif;
+               ieee80211_free_node(ni);
+               m_freem(m);
+       }
+}
+
+static void
 iwm_scan_start(struct ieee80211com *ic)
 {
        struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
@@ -6522,6 +6536,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
        callout_drain(&sc->sc_watchdog_to);
        iwm_stop_device(sc);
        if (do_net80211) {
+               IWM_LOCK(sc);
+               iwm_xmit_queue_drain(sc);
+               IWM_UNLOCK(sc);
                ieee80211_ifdetach(&sc->sc_ic);
        }
 
@@ -6555,7 +6572,6 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
                sc->sc_notif_wait = NULL;
        }
 
-       mbufq_drain(&sc->sc_snd);
        IWM_LOCK_DESTROY(sc);
 
        return (0);

Modified: stable/11/sys/dev/iwm/if_iwm_sta.c
==============================================================================
--- stable/11/sys/dev/iwm/if_iwm_sta.c  Thu Mar  1 06:54:03 2018        
(r330222)
+++ stable/11/sys/dev/iwm/if_iwm_sta.c  Thu Mar  1 06:55:46 2018        
(r330223)
@@ -283,7 +283,6 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211v
        ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE);
        if (ret)
                return ret;
-       mbufq_drain(&sc->sc_snd); /* XXX needed ? */
        for (ac = 0; ac < WME_NUM_AC; ac++) {
                tfd_queue_msk |= htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to