diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-07-10 13:39:02 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-07-12 06:10:49 -0400 |
commit | 8e95ea49c94908cb10e698c5637d57f0fbdc796d (patch) | |
tree | 597f5817baab936980b6d888bfe695e8a40dc747 /net/wireless/util.c | |
parent | 2a9e6c58871df77b69afffad250062853570ee23 (diff) |
cfg80211: fix locking and lockdep complaints
To call cfg80211_get_chan_state() we need to lock
the wdev, so we need to lock the wdev_iter mutex
in cfg80211_can_use_iftype_chan(). This needs to
use nested locking for lockdep.
Also, cfg80211_get_chan_state() doesn't actually
use the rdev, so remove that completely including
the lock assertion that isn't needed.
Reported-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r-- | net/wireless/util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c index f7a0647bde9a..26f8cd30f712 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -1059,7 +1059,16 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | |||
1059 | if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) | 1059 | if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) |
1060 | continue; | 1060 | continue; |
1061 | 1061 | ||
1062 | cfg80211_get_chan_state(rdev, wdev_iter, &ch, &chmode); | 1062 | /* |
1063 | * We may be holding the "wdev" mutex, but now need to lock | ||
1064 | * wdev_iter. This is OK because once we get here wdev_iter | ||
1065 | * is not wdev (tested above), but we need to use the nested | ||
1066 | * locking for lockdep. | ||
1067 | */ | ||
1068 | mutex_lock_nested(&wdev_iter->mtx, 1); | ||
1069 | __acquire(wdev_iter->mtx); | ||
1070 | cfg80211_get_chan_state(wdev_iter, &ch, &chmode); | ||
1071 | wdev_unlock(wdev_iter); | ||
1063 | 1072 | ||
1064 | switch (chmode) { | 1073 | switch (chmode) { |
1065 | case CHAN_MODE_UNDEFINED: | 1074 | case CHAN_MODE_UNDEFINED: |