Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Feb 2007 12:53:18 GMT
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 114288 for review
Message-ID:  <200702091253.l19CrIZc004423@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114288

Change 114288 by sephe@sephe_zealot:sam_wifi on 2007/02/09 12:52:33

	Avoid possible mbuf re-tap on error path.
	Obtained-from:	DragonFly

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#80 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#80 (text+ko) ====

@@ -139,7 +139,7 @@
 	struct ieee80211_frame *wh;
 	struct ieee80211_key *key;
 	struct ether_header *eh;
-	int hdrspace;
+	int hdrspace, need_tap;
 	u_int8_t dir, type, subtype;
 	u_int8_t *bssid;
 	u_int16_t rxseq;
@@ -152,6 +152,7 @@
 		m_adj(m, -IEEE80211_CRC_LEN);
 		m->m_flags &= ~M_HASFCS;
 	}
+	need_tap = 1;			/* mbuf need to be tapped. */
 	type = -1;			/* undefined */
 	/*
 	 * In monitor mode, send everything directly to bpf.
@@ -427,6 +428,7 @@
 		/* copy to listener after decrypt */
 		if (bpf_peers_present(ic->ic_rawbpf))
 			bpf_mtap(ic->ic_rawbpf, m);
+		need_tap = 0;
 
 		/*
 		 * Finally, strip the 802.11 header.
@@ -588,7 +590,7 @@
 	ifp->if_ierrors++;
 out:
 	if (m != NULL) {
-		if (bpf_peers_present(ic->ic_rawbpf))
+		if (bpf_peers_present(ic->ic_rawbpf) && need_tap)
 			bpf_mtap(ic->ic_rawbpf, m);
 		m_freem(m);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702091253.l19CrIZc004423>