]> Pileus Git - ~andy/linux/blobdiff - net/mac80211/cfg.c
ARM: OMAP2+: UART: cleanup 8250 console driver support
[~andy/linux] / net / mac80211 / cfg.c
index ebd7fb101fbfb26dc7e7850eae1a0c7d14283d9a..d06c65fa5526a88739a647b809067f37fd64fc24 100644 (file)
@@ -832,6 +832,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
        if (is_multicast_ether_addr(mac))
                return -EINVAL;
 
+       /* Only TDLS-supporting stations can add TDLS peers */
+       if ((params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) &&
+           !((wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
+             sdata->vif.type == NL80211_IFTYPE_STATION))
+               return -ENOTSUPP;
+
        sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
        if (!sta)
                return -ENOMEM;
@@ -841,12 +847,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
 
        sta_apply_parameters(local, sta, params);
 
-       /* Only TDLS-supporting stations can add TDLS peers */
-       if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
-           !((wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
-             sdata->vif.type == NL80211_IFTYPE_STATION))
-               return -ENOTSUPP;
-
        rate_control_rate_init(sta);
 
        layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||