]> err.no Git - linux-2.6/commitdiff
rt2x00: Block all unsupported modes
authorIvo van Doorn <ivdoorn@gmail.com>
Wed, 6 Aug 2008 14:18:31 +0000 (16:18 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 7 Aug 2008 13:49:04 +0000 (09:49 -0400)
It was possible for unsupported operating modes
to be accepted by the add_interface callback function.
This patch will block those modes until proper support
has been implemented for them.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00mac.c

index bd422fd6a89433b7daa7e2b3c799eaedce970f03..d06507388635c9080f68e034934220853776a3e1 100644 (file)
@@ -203,23 +203,43 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
            !test_bit(DEVICE_STARTED, &rt2x00dev->flags))
                return -ENODEV;
 
-       /*
-        * We don't support mixed combinations of sta and ap virtual
-        * interfaces. We can only add this interface when the rival
-        * interface count is 0.
-        */
-       if ((conf->type == IEEE80211_IF_TYPE_AP && rt2x00dev->intf_sta_count) ||
-           (conf->type != IEEE80211_IF_TYPE_AP && rt2x00dev->intf_ap_count))
-               return -ENOBUFS;
-
-       /*
-        * Check if we exceeded the maximum amount of supported interfaces.
-        */
-       if ((conf->type == IEEE80211_IF_TYPE_AP &&
-            rt2x00dev->intf_ap_count >= rt2x00dev->ops->max_ap_intf) ||
-           (conf->type != IEEE80211_IF_TYPE_AP &&
-            rt2x00dev->intf_sta_count >= rt2x00dev->ops->max_sta_intf))
-               return -ENOBUFS;
+       switch (conf->type) {
+       case IEEE80211_IF_TYPE_AP:
+               /*
+                * We don't support mixed combinations of
+                * sta and ap interfaces.
+                */
+               if (rt2x00dev->intf_sta_count)
+                       return -ENOBUFS;
+
+               /*
+                * Check if we exceeded the maximum amount
+                * of supported interfaces.
+                */
+               if (rt2x00dev->intf_ap_count >= rt2x00dev->ops->max_ap_intf)
+                       return -ENOBUFS;
+
+               break;
+       case IEEE80211_IF_TYPE_STA:
+       case IEEE80211_IF_TYPE_IBSS:
+               /*
+                * We don't support mixed combinations of
+                * sta and ap interfaces.
+                */
+               if (rt2x00dev->intf_ap_count)
+                       return -ENOBUFS;
+
+               /*
+                * Check if we exceeded the maximum amount
+                * of supported interfaces.
+                */
+               if (rt2x00dev->intf_sta_count >= rt2x00dev->ops->max_sta_intf)
+                       return -ENOBUFS;
+
+               break;
+       default:
+               return -EINVAL;
+       }
 
        /*
         * Loop through all beacon queues to find a free