1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

close a race between reclaiming a node when a station is inactive

and sending the null data frame used to probe inactive stations

MFC after:	5 days
This commit is contained in:
Sam Leffler 2005-07-31 06:12:32 +00:00
parent 55234c1cf4
commit 19ad2dd79a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148582
3 changed files with 15 additions and 2 deletions

View File

@ -2711,7 +2711,7 @@ ieee80211_recv_pspoll(struct ieee80211com *ic,
IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
"[%s] recv ps-poll, but queue empty\n",
ether_sprintf(wh->i_addr2));
ieee80211_send_nulldata(ni);
ieee80211_send_nulldata(ieee80211_ref_node(ni));
ic->ic_stats.is_ps_qempty++; /* XXX node stat */
if (ic->ic_set_tim != NULL)
ic->ic_set_tim(ni, 0); /* just in case */

View File

@ -1474,6 +1474,14 @@ IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER, "[%s] discard frame, age %u\n", ether
IEEE80211_MSG_INACT | IEEE80211_MSG_NODE,
ni, "%s",
"probe station due to inactivity");
/*
* Grab a reference before unlocking the table
* so the node cannot be reclaimed before we
* send the frame. ieee80211_send_nulldata
* understands we've done this and reclaims the
* ref for us as needed.
*/
ieee80211_ref_node(ni);
IEEE80211_NODE_UNLOCK(nt);
ieee80211_send_nulldata(ni);
/* XXX stat? */

View File

@ -199,6 +199,10 @@ ieee80211_mgmt_output(struct ieee80211com *ic, struct ieee80211_node *ni,
/*
* Send a null data frame to the specified node.
*
* NB: the caller is assumed to have setup a node reference
* for use; this is necessary to deal with a race condition
* when probing for inactive stations.
*/
int
ieee80211_send_nulldata(struct ieee80211_node *ni)
@ -212,9 +216,10 @@ ieee80211_send_nulldata(struct ieee80211_node *ni)
if (m == NULL) {
/* XXX debug msg */
ic->ic_stats.is_tx_nobuf++;
ieee80211_unref_node(&ni);
return ENOMEM;
}
m->m_pkthdr.rcvif = (void *) ieee80211_ref_node(ni);
m->m_pkthdr.rcvif = (void *) ni;
wh = mtod(m, struct ieee80211_frame *);
ieee80211_send_setup(ic, ni, wh,