mac80211: check interface is down before type change
[safe/jmp/linux-2.6] / net / mac80211 / cfg.c
index 5608f6c..7b5131b 100644 (file)
@@ -72,6 +72,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
        struct ieee80211_sub_if_data *sdata;
        int ret;
 
+       if (netif_running(dev))
+               return -EBUSY;
+
        if (!nl80211_type_check(type))
                return -EINVAL;
 
@@ -81,9 +84,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
        if (ret)
                return ret;
 
-       if (netif_running(sdata->dev))
-               return -EBUSY;
-
        if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
                ieee80211_sdata_set_mesh_id(sdata,
                                            params->mesh_id_len,