mac80211: fix offchannel TX cookie matching
authorJohannes Berg <johannes.berg@intel.com>
Tue, 4 Oct 2011 16:27:10 +0000 (18:27 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:35:51 +0000 (09:35 -0800)
commit 28a1bcdb57d50f3038a255741ecc83e391e5282e upstream.

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.

Reported-by: Jouni Malinen <j@w1.fi>
Tested-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/status.c
net/mac80211/work.c

index be70c70d3f5bfa6ecfb57e56d3b12eb06e6f78e9..143a0064348aaa489ac6ec17d6ceccfee4d38b0f 100644 (file)
@@ -1798,7 +1798,7 @@ ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb)
         * 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);
index 090b0ec1e05653c246973a74de8fe4c6057f261e..0c5aed2257fb83f43d755b94ba612411211f753c 100644 (file)
@@ -328,6 +328,7 @@ struct ieee80211_work {
                struct {
                        struct sk_buff *frame;
                        u32 wait;
+                       bool status;
                } offchan_tx;
        };
 
index 1658efaa2e8eef4b042ec05ffd875cbd0d3c6ec1..04cdbaf160ba7651a2a0b434fc0208c5aad587a3 100644 (file)
@@ -336,7 +336,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
                                continue;
                        if (wk->offchan_tx.frame != skb)
                                continue;
-                       wk->offchan_tx.frame = NULL;
+                       wk->offchan_tx.status = true;
                        break;
                }
                rcu_read_unlock();
index d2e7f0e866772ed0fb3969837d9aab62d27bd755..dc8ec05a8fc54aa6ff09954d8403f83dffd0a55d 100644 (file)
@@ -553,7 +553,7 @@ ieee80211_offchannel_tx(struct ieee80211_work *wk)
                /*
                 * 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);