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>
This commit is contained in:

committed by
Johannes Berg

parent
d4e50c5917
commit
e4e32459c2
@@ -805,8 +805,10 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
|
||||
return -EBUSY;
|
||||
|
||||
if (ntype != otype && netif_running(dev)) {
|
||||
mutex_lock(&rdev->devlist_mtx);
|
||||
err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr,
|
||||
ntype);
|
||||
mutex_unlock(&rdev->devlist_mtx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -956,6 +958,7 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
|
||||
int i, j;
|
||||
|
||||
ASSERT_RTNL();
|
||||
lockdep_assert_held(&rdev->devlist_mtx);
|
||||
|
||||
/* Always allow software iftypes */
|
||||
if (rdev->wiphy.software_iftypes & BIT(iftype))
|
||||
@@ -979,7 +982,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_lock(&rdev->devlist_mtx);
|
||||
list_for_each_entry(wdev_iter, &rdev->netdev_list, list) {
|
||||
if (wdev_iter == wdev)
|
||||
continue;
|
||||
@@ -999,10 +1001,8 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
|
||||
if (!used_channels[i] || used_channels[i] == ch)
|
||||
break;
|
||||
|
||||
if (i == CFG80211_MAX_NUM_DIFFERENT_CHANNELS) {
|
||||
mutex_unlock(&rdev->devlist_mtx);
|
||||
if (i == CFG80211_MAX_NUM_DIFFERENT_CHANNELS)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (used_channels[i] == NULL) {
|
||||
used_channels[i] = ch;
|
||||
@@ -1018,7 +1018,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
|
||||
total++;
|
||||
used_iftypes |= BIT(wdev_iter->iftype);
|
||||
}
|
||||
mutex_unlock(&rdev->devlist_mtx);
|
||||
|
||||
if (total == 1)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user