Skip to content

Commit

Permalink
mac80211: fix tim_lock locking
Browse files Browse the repository at this point in the history
The ieee80211_beacon_add_tim() function might be called
by drivers with BHs enabled, which causes a potential
deadlock if TX happens at the same time and attempts to
lock the tim_lock as well. Use spin_lock_bh to fix it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
jmberg-intel committed Feb 25, 2013
1 parent dc4a787 commit 1b91731
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2360,9 +2360,9 @@ static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata,
if (local->tim_in_locked_section) {
__ieee80211_beacon_add_tim(sdata, ps, skb);
} else {
spin_lock(&local->tim_lock);
spin_lock_bh(&local->tim_lock);
__ieee80211_beacon_add_tim(sdata, ps, skb);
spin_unlock(&local->tim_lock);
spin_unlock_bh(&local->tim_lock);
}

return 0;
Expand Down

0 comments on commit 1b91731

Please sign in to comment.