aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/util.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2012-06-29 06:47:08 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-29 07:39:19 -0400
commite4e32459c2daea59516da59999706b357e6eb480 (patch)
tree110014ac72ebcf7aed16caa0fa83da75e319fa86 /net/wireless/util.c
parentd4e50c5917e110451ced8f8de594cea858791f37 (diff)
cfg80211: respect iface combinations when starting operation
devlist_mtx locking is changed to accomodate changes. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 4713cea9a2fa..a9260ac85cf1 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -805,8 +805,10 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
805 return -EBUSY; 805 return -EBUSY;
806 806
807 if (ntype != otype && netif_running(dev)) { 807 if (ntype != otype && netif_running(dev)) {
808 mutex_lock(&rdev->devlist_mtx);
808 err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr, 809 err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr,
809 ntype); 810 ntype);
811 mutex_unlock(&rdev->devlist_mtx);
810 if (err) 812 if (err)
811 return err; 813 return err;
812 814
@@ -956,6 +958,7 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
956 int i, j; 958 int i, j;
957 959
958 ASSERT_RTNL(); 960 ASSERT_RTNL();
961 lockdep_assert_held(&rdev->devlist_mtx);
959 962
960 /* Always allow software iftypes */ 963 /* Always allow software iftypes */
961 if (rdev->wiphy.software_iftypes & BIT(iftype)) 964 if (rdev->wiphy.software_iftypes & BIT(iftype))
@@ -979,7 +982,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
979 break; 982 break;
980 } 983 }
981 984
982 mutex_lock(&rdev->devlist_mtx);
983 list_for_each_entry(wdev_iter, &rdev->netdev_list, list) { 985 list_for_each_entry(wdev_iter, &rdev->netdev_list, list) {
984 if (wdev_iter == wdev) 986 if (wdev_iter == wdev)
985 continue; 987 continue;
@@ -999,10 +1001,8 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
999 if (!used_channels[i] || used_channels[i] == ch) 1001 if (!used_channels[i] || used_channels[i] == ch)
1000 break; 1002 break;
1001 1003
1002 if (i == CFG80211_MAX_NUM_DIFFERENT_CHANNELS) { 1004 if (i == CFG80211_MAX_NUM_DIFFERENT_CHANNELS)
1003 mutex_unlock(&rdev->devlist_mtx);
1004 return -EBUSY; 1005 return -EBUSY;
1005 }
1006 1006
1007 if (used_channels[i] == NULL) { 1007 if (used_channels[i] == NULL) {
1008 used_channels[i] = ch; 1008 used_channels[i] = ch;
@@ -1018,7 +1018,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
1018 total++; 1018 total++;
1019 used_iftypes |= BIT(wdev_iter->iftype); 1019 used_iftypes |= BIT(wdev_iter->iftype);
1020 } 1020 }
1021 mutex_unlock(&rdev->devlist_mtx);
1022 1021
1023 if (total == 1) 1022 if (total == 1)
1024 return 0; 1023 return 0;