mac80211: fix SMPS debugfs locking

The locking with SMPS requests means that the
debugs file should lock the mgd mutex, not the
iflist mutex. Calls to __ieee80211_request_smps()
need to hold that mutex, so add an assertion.

This has always been wrong, but for some reason
never been noticed, probably because the locking
error only happens while unassociated.

Cc: stable@kernel.org [2.6.34+]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by Johannes Berg and committed by John W. Linville 243e6df4 10e99777

+4 -2
+2
net/mac80211/cfg.c
··· 1504 enum ieee80211_smps_mode old_req; 1505 int err; 1506 1507 old_req = sdata->u.mgd.req_smps; 1508 sdata->u.mgd.req_smps = smps_mode; 1509
··· 1504 enum ieee80211_smps_mode old_req; 1505 int err; 1506 1507 + lockdep_assert_held(&sdata->u.mgd.mtx); 1508 + 1509 old_req = sdata->u.mgd.req_smps; 1510 sdata->u.mgd.req_smps = smps_mode; 1511
+2 -2
net/mac80211/debugfs_netdev.c
··· 177 if (sdata->vif.type != NL80211_IFTYPE_STATION) 178 return -EOPNOTSUPP; 179 180 - mutex_lock(&local->iflist_mtx); 181 err = __ieee80211_request_smps(sdata, smps_mode); 182 - mutex_unlock(&local->iflist_mtx); 183 184 return err; 185 }
··· 177 if (sdata->vif.type != NL80211_IFTYPE_STATION) 178 return -EOPNOTSUPP; 179 180 + mutex_lock(&sdata->u.mgd.mtx); 181 err = __ieee80211_request_smps(sdata, smps_mode); 182 + mutex_unlock(&sdata->u.mgd.mtx); 183 184 return err; 185 }