Commit 4b181144 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

cfg80211: fix locking for SIWFREQ

"cfg80211: validate channel settings across interfaces"
contained a locking bug -- in the managed-mode SIWFREQ
call it would end up running into a lock recursion.

This fixes it by not checking that particular interface
for a channel that it needs to stay on, which is as it
should be as that's the interface we're setting the
channel for.
Reported-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Reported-by: default avatarKalle Valo <kalle.valo@iki.fi>
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Tested-by: default avatarKalle Valo <kalle.valo@iki.fi>
Tested-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e312c24c
...@@ -42,13 +42,14 @@ rdev_fixed_channel(struct cfg80211_registered_device *rdev, ...@@ -42,13 +42,14 @@ rdev_fixed_channel(struct cfg80211_registered_device *rdev,
} }
int rdev_set_freq(struct cfg80211_registered_device *rdev, int rdev_set_freq(struct cfg80211_registered_device *rdev,
struct wireless_dev *for_wdev,
int freq, enum nl80211_channel_type channel_type) int freq, enum nl80211_channel_type channel_type)
{ {
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
struct ieee80211_sta_ht_cap *ht_cap; struct ieee80211_sta_ht_cap *ht_cap;
int result; int result;
if (rdev_fixed_channel(rdev, NULL)) if (rdev_fixed_channel(rdev, for_wdev))
return -EBUSY; return -EBUSY;
if (!rdev->ops->set_channel) if (!rdev->ops->set_channel)
......
...@@ -374,6 +374,7 @@ struct ieee80211_channel * ...@@ -374,6 +374,7 @@ struct ieee80211_channel *
rdev_fixed_channel(struct cfg80211_registered_device *rdev, rdev_fixed_channel(struct cfg80211_registered_device *rdev,
struct wireless_dev *for_wdev); struct wireless_dev *for_wdev);
int rdev_set_freq(struct cfg80211_registered_device *rdev, int rdev_set_freq(struct cfg80211_registered_device *rdev,
struct wireless_dev *for_wdev,
int freq, enum nl80211_channel_type channel_type); int freq, enum nl80211_channel_type channel_type);
#endif /* __NET_WIRELESS_CORE_H */ #endif /* __NET_WIRELESS_CORE_H */
...@@ -721,7 +721,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) ...@@ -721,7 +721,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
mutex_lock(&rdev->devlist_mtx); mutex_lock(&rdev->devlist_mtx);
result = rdev_set_freq(rdev, freq, channel_type); result = rdev_set_freq(rdev, NULL, freq, channel_type);
mutex_unlock(&rdev->devlist_mtx); mutex_unlock(&rdev->devlist_mtx);
if (result) if (result)
goto bad_res; goto bad_res;
......
...@@ -766,7 +766,7 @@ int cfg80211_wext_siwfreq(struct net_device *dev, ...@@ -766,7 +766,7 @@ int cfg80211_wext_siwfreq(struct net_device *dev,
if (freq == 0) if (freq == 0)
return -EINVAL; return -EINVAL;
mutex_lock(&rdev->devlist_mtx); mutex_lock(&rdev->devlist_mtx);
err = rdev_set_freq(rdev, freq, NL80211_CHAN_NO_HT); err = rdev_set_freq(rdev, NULL, freq, NL80211_CHAN_NO_HT);
mutex_unlock(&rdev->devlist_mtx); mutex_unlock(&rdev->devlist_mtx);
return err; return err;
} }
......
...@@ -106,7 +106,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, ...@@ -106,7 +106,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
/* SSID is not set, we just want to switch channel */ /* SSID is not set, we just want to switch channel */
if (chan && !wdev->wext.connect.ssid_len) { if (chan && !wdev->wext.connect.ssid_len) {
err = rdev_set_freq(rdev, freq, NL80211_CHAN_NO_HT); err = rdev_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment