From patchwork Wed Mar 30 22:54:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Rodriguez X-Patchwork-Id: 678041 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2UMsaHM023581 for ; Wed, 30 Mar 2011 22:54:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756436Ab1C3Wyc (ORCPT ); Wed, 30 Mar 2011 18:54:32 -0400 Received: from mail.atheros.com ([12.19.149.2]:18458 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754730Ab1C3Wyc (ORCPT ); Wed, 30 Mar 2011 18:54:32 -0400 Received: from mail.atheros.com ([10.10.20.105]) by sidewinder.atheros.com for ; Wed, 30 Mar 2011 15:54:07 -0700 Received: from tux (10.10.10.239) by SC1EXHC-01.global.atheros.com (10.10.20.106) with Microsoft SMTP Server (TLS) id 8.2.213.0; Wed, 30 Mar 2011 15:54:30 -0700 Received: by tux (sSMTP sendmail emulation); Wed, 30 Mar 2011 15:54:29 -0700 From: "Luis R. Rodriguez" To: CC: , , "Johannes Berg" , "John W. Linville" , "Luis R. Rodriguez" Subject: [PATCH v2.6.38.2] iwlegacy: fix bugs in change_interface Date: Wed, 30 Mar 2011 15:54:28 -0700 Message-ID: <1301525668-23041-1-git-send-email-lrodriguez@atheros.com> X-Mailer: git-send-email 1.7.4.15.g7811d MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 30 Mar 2011 22:54:37 +0000 (UTC) diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index efbde1f..3a054db 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c @@ -1867,6 +1867,15 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mutex_lock(&priv->mutex); + if (!ctx->vif || !iwl_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))) { @@ -1894,6 +1903,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, /* success */ iwl_teardown_interface(priv, vif, true); vif->type = newtype; + vif->p2p = newp2p; err = iwl_setup_interface(priv, ctx); WARN_ON(err); /*