]> Pileus Git - ~andy/linux/blobdiff - net/mac80211/cfg.c
Merge tag 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[~andy/linux] / net / mac80211 / cfg.c
index 808f5fcd1ced92127f8786700a759465e0708060..fb306814576affa7e636fa53353d29ba1e39b668 100644 (file)
@@ -3290,14 +3290,19 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
        int ret = -ENODATA;
 
        rcu_read_lock();
-       if (local->use_chanctx) {
-               chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
-               if (chanctx_conf) {
-                       *chandef = chanctx_conf->def;
-                       ret = 0;
-               }
-       } else if (local->open_count == local->monitors) {
-               *chandef = local->monitor_chandef;
+       chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+       if (chanctx_conf) {
+               *chandef = chanctx_conf->def;
+               ret = 0;
+       } else if (local->open_count > 0 &&
+                  local->open_count == local->monitors &&
+                  sdata->vif.type == NL80211_IFTYPE_MONITOR) {
+               if (local->use_chanctx)
+                       *chandef = local->monitor_chandef;
+               else
+                       cfg80211_chandef_create(chandef,
+                                               local->_oper_channel,
+                                               local->_oper_channel_type);
                ret = 0;
        }
        rcu_read_unlock();