From: Nikolay Martynov <mar.kolya@xxxxxxxxx> If addBA responses comes in just after addba_resp_timer has expired mac80211 will still accept it and try to open the aggregation session. This causes drivers to be confused and in some cases even crash. This patch fixes the race condition and makes sure that if addba_resp_timer has expired addBA response is not longer accepted and we do not try to open half-closed session. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Nikolay Martynov <mar.kolya@xxxxxxxxx> [some adjustments] Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- v3: adjust message net/mac80211/agg-tx.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/net/mac80211/agg-tx.c 2011-11-27 12:51:16.000000000 +0100 +++ b/net/mac80211/agg-tx.c 2011-11-27 12:52:30.000000000 +0100 @@ -762,11 +762,27 @@ void ieee80211_process_addba_resp(struct goto out; } - del_timer(&tid_tx->addba_resp_timer); + del_timer_sync(&tid_tx->addba_resp_timer); #ifdef CONFIG_MAC80211_HT_DEBUG printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); #endif + + /* + * addba_resp_timer may have fired before we got here, and + * caused WANT_STOP to be set. STOPPING should not be set + * as we're under the mutex, but check it anyway. + */ + if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || + test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { +#ifdef CONFIG_MAC80211_HT_DEBUG + printk(KERN_DEBUG + "got addBA resp for tid %d but we already gave up\n", + tid); +#endif + goto out; + } + /* * IEEE 802.11-2007 7.3.1.14: * In an ADDBA Response frame, when the Status Code field -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html