Commit e562078a19226660299eeaf40a50752672214f11

Authored by Ben Greear
Committed by Johannes Berg
1 parent 661eb3811d

mac80211: Ensure tid_start_tx is protected by sta->lock

All accesses of the tid_start_tx lock should be protected
by sta->lock if there is any chance that another thread
could still be accessing the sta object.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Showing 2 changed files with 4 additions and 1 deletions Side-by-side Diff

... ... @@ -281,13 +281,14 @@
281 281 sta, tid, WLAN_BACK_RECIPIENT,
282 282 WLAN_REASON_UNSPECIFIED, true);
283 283  
  284 + spin_lock_bh(&sta->lock);
  285 +
284 286 tid_tx = sta->ampdu_mlme.tid_start_tx[tid];
285 287 if (tid_tx) {
286 288 /*
287 289 * Assign it over to the normal tid_tx array
288 290 * where it "goes live".
289 291 */
290   - spin_lock_bh(&sta->lock);
291 292  
292 293 sta->ampdu_mlme.tid_start_tx[tid] = NULL;
293 294 /* could there be a race? */
... ... @@ -300,6 +301,7 @@
300 301 ieee80211_tx_ba_session_handle_start(sta, tid);
301 302 continue;
302 303 }
  304 + spin_unlock_bh(&sta->lock);
303 305  
304 306 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
305 307 if (tid_tx && test_and_clear_bit(HT_AGG_STATE_WANT_STOP,
net/mac80211/sta_info.h
... ... @@ -203,6 +203,7 @@
203 203 * driver requested to close until the work for it runs
204 204 * @mtx: mutex to protect all TX data (except non-NULL assignments
205 205 * to tid_tx[idx], which are protected by the sta spinlock)
  206 + * tid_start_tx is also protected by sta->lock.
206 207 */
207 208 struct sta_ampdu_mlme {
208 209 struct mutex mtx;