Merge branch 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6
[linux-2.6.git] / drivers / net / wireless / iwlegacy / iwl-core.c
index 1c3a8cb..7007d61 100644 (file)
@@ -1805,6 +1805,15 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
 
        mutex_lock(&priv->mutex);
 
+       if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) {
+               /*
+                * Huh? But wait ... this can maybe happen when
+                * we're in the middle of a firmware restart!
+                */
+               err = -EBUSY;
+               goto out;
+       }
+
        interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
 
        if (!(interface_modes & BIT(newtype))) {
@@ -1832,6 +1841,7 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
        /* success */
        iwl_legacy_teardown_interface(priv, vif, true);
        vif->type = newtype;
+       vif->p2p = newp2p;
        err = iwl_legacy_setup_interface(priv, ctx);
        WARN_ON(err);
        /*