PERFORCE change 69338 for review

Sam Leffler sam at FreeBSD.org
Wed Jan 19 17:14:15 PST 2005


http://perforce.freebsd.org/chv.cgi?CH=69338

Change 69338 by sam at sam_ebb on 2005/01/20 01:13:59

	fix refcnt leak in adhoc mode: entries in the neighbor table
	created due to rx'd frames had an extra reference

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_node.c#44 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_node.c#44 (text+ko) ====

@@ -1014,7 +1014,6 @@
 			ic->ic_newassoc(ic, ni, 1);
 		/* XXX not right for 802.1x/WPA */
 		ieee80211_node_authorize(ic, ni);
-		ieee80211_ref_node(ni);		/* hold reference */
 	}
 	return ni;
 }
@@ -1094,9 +1093,16 @@
 
 	if (ni == NULL) {
 		if (ic->ic_opmode == IEEE80211_M_IBSS ||
-		    ic->ic_opmode == IEEE80211_M_AHDEMO)
+		    ic->ic_opmode == IEEE80211_M_AHDEMO) {
+			/*
+			 * In adhoc mode cons up a node for the destination.
+			 * Note that we need an additional reference for the
+			 * caller to be consistent with _ieee80211_find_node.
+			 */
 			ni = ieee80211_fakeup_adhoc_node(nt, macaddr);
-		else {
+			if (ni != NULL)
+				(void) ieee80211_ref_node(ni);
+		} else {
 			IEEE80211_DPRINTF(ic, IEEE80211_MSG_OUTPUT,
 				"[%s] no node, discard frame (%s)\n",
 				ether_sprintf(macaddr), __func__);


More information about the p4-projects mailing list