Skip to content

Commit

Permalink
mac80211: don't stop a single aggregation session twice
Browse files Browse the repository at this point in the history
Nikolay noticed (by code review) that mac80211 can
attempt to stop an aggregation session while it is
already being stopped. So to fix it, check whether
stop is already being done and bail out if so.

Also move setting the STOPPING state into the lock
so things are properly atomic.

Cc: [email protected]
Reported-by: Nikolay Martynov <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
jmberg-intel authored and linvjw committed Nov 28, 2011
1 parent e007b85 commit 24f50a9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/mac80211/agg-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
return -ENOENT;
}

/* if we're already stopping ignore any new requests to stop */
if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
spin_unlock_bh(&sta->lock);
return -EALREADY;
}

if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
/* not even started yet! */
ieee80211_assign_tid_tx(sta, tid, NULL);
Expand All @@ -168,15 +174,15 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
return 0;
}

set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state);

spin_unlock_bh(&sta->lock);

#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
sta->sta.addr, tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */

set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state);

del_timer_sync(&tid_tx->addba_resp_timer);

/*
Expand Down

0 comments on commit 24f50a9

Please sign in to comment.