Skip to contentSkip to conversation

mac80211: only single mutex locked to prevent deadlock

PATCH In review [email protected] 2 participants 2 messages Jan 25, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: only single mutex locked to prevent deadlock

From: Wey-Yi Guy <[email protected]>

Both ifmgd->mtx and sdata->local->iflist_mtx are locked in ieee80211_mgd_probe_ap(), not sure it will cause deadlock condition. but it is better to only has one mutex at a time.

---
 net/mac80211/mlme.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
net/mac80211/mlme.c +3 -0
index 1e1d16c..e23df14 100644
@@ -914,10 +914,13 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
 	if (already)
 		goto out;
 
+	mutex_unlock(&ifmgd->mtx);
+
 	mutex_lock(&sdata->local->iflist_mtx);
 	ieee80211_recalc_ps(sdata->local, -1);
 	mutex_unlock(&sdata->local->iflist_mtx);
 
+	mutex_lock(&ifmgd->mtx);
 	ifmgd->probe_send_count = 0;
 	ieee80211_mgd_probe_ap_send(sdata);
  out:
Signature · 1 line
1.5.6.3
maintainer
#1 lore raw
Quoted 5 lines · On Mon, 2010-01-25 at 10:12 -0800, [email protected] wrote:

From: Wey-Yi Guy <[email protected]>

Both ifmgd->mtx and sdata->local->iflist_mtx are locked in ieee80211_mgd_probe_ap(), not sure it will cause deadlock condition. but it is better to only has one mutex at a time.

It shouldn't cause a deadlock, we do this all the time, e.g. in ieee80211_rx_mgmt_probe_resp(), so I don't think the extra locking makes a lot of sense.

johannes