Skip to contentSkip to conversation

mac80211: fix offchannel TX cookie matching

PATCH New Johannes Berg 1 participant 1 message Oct 4, 2011 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: fix offchannel TX cookie matching

From: Johannes Berg <[email protected]>

When I introduced in-kernel off-channel TX I introduced a bug -- the work can't be canceled again because the code clear the skb pointer. Fix this by keeping track separately of whether TX status has already been reported.

---
 net/mac80211/cfg.c         |    2 +-
 net/mac80211/ieee80211_i.h |    1 +
 net/mac80211/status.c      |    2 +-
 net/mac80211/work.c        |    2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)
net/mac80211/cfg.c +1 -1
@@ -1886,7 +1886,7 @@ ieee80211_offchan_tx_done(struct ieee802
 	 * so in that case userspace will have to deal with it.
 	 */
 
-	if (wk->offchan_tx.wait && wk->offchan_tx.frame)
+	if (wk->offchan_tx.wait && !wk->offchan_tx.status)
 		cfg80211_mgmt_tx_status(wk->sdata->dev,
 					(unsigned long) wk->offchan_tx.frame,
 					wk->ie, wk->ie_len, false, GFP_KERNEL);
net/mac80211/ieee80211_i.h +1 -0
@@ -346,6 +346,7 @@ struct ieee80211_work {
 		struct {
 			struct sk_buff *frame;
 			u32 wait;
+			bool status;
 		} offchan_tx;
 	};
 
net/mac80211/status.c +1 -1
@@ -429,7 +429,7 @@ void ieee80211_tx_status(struct ieee8021
 				continue;
 			if (wk->offchan_tx.frame != skb)
 				continue;
-			wk->offchan_tx.frame = NULL;
+			wk->offchan_tx.status = true;
 			break;
 		}
 		rcu_read_unlock();
net/mac80211/work.c +1 -1
@@ -577,7 +577,7 @@ ieee80211_offchannel_tx(struct ieee80211
 		/*
 		 * After this, offchan_tx.frame remains but now is no
 		 * longer a valid pointer -- we still need it as the
-		 * cookie for canceling this work.
+		 * cookie for canceling this work/status matching.
 		 */
 		ieee80211_tx_skb(wk->sdata, wk->offchan_tx.frame);