Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757207Ab3HQANz (ORCPT ); Fri, 16 Aug 2013 20:13:55 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51628 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756569Ab3HPWjW (ORCPT ); Fri, 16 Aug 2013 18:39:22 -0400 From: Kamal Mostafa To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Johannes Berg , Luis Henriques , Kamal Mostafa Subject: [PATCH 045/133] iwlwifi: mvm: refuse connection to APs with BI < 16 Date: Fri, 16 Aug 2013 15:33:07 -0700 Message-Id: <1376692475-28413-46-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1376692475-28413-1-git-send-email-kamal@canonical.com> References: <1376692475-28413-1-git-send-email-kamal@canonical.com> X-Extended-Stable: 3.8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2783 Lines: 74 3.8.13.7 -stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Berg commit 48bc13072109ea58465542aa1ee31b4e1065468a upstream. Due to a firmware bug, it crashes when the beacon interval is smaller than 16. Avoid this by refusing the station state change creating the AP station, causing mac80211 to abandon the attempt to connect to the AP, and eventually wpa_s to blacklist it. Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg [ luis: backported to 3.5: - file renamed: drivers/net/wireless/iwlwifi/mvm/mac80211.c -> drivers/net/wireless/iwlwifi/iwl-mac80211.c - adjusted context - changed IWL_ERR 1st argument to 'priv' - removed redundant condition in 'if' statement ] Signed-off-by: Luis Henriques Signed-off-by: Kamal Mostafa --- drivers/net/wireless/iwlwifi/dvm/mac80211.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index 3163e0f..c784f69 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c @@ -786,9 +786,23 @@ static int iwlagn_mac_sta_state(struct ieee80211_hw *hw, mutex_lock(&priv->mutex); if (vif->type == NL80211_IFTYPE_STATION) { if (old_state == IEEE80211_STA_NOTEXIST && - new_state == IEEE80211_STA_NONE) + new_state == IEEE80211_STA_NONE) { + /* + * Firmware bug - it'll crash if the beacon interval is less + * than 16. We can't avoid connecting at all, so refuse the + * station state change, this will cause mac80211 to abandon + * attempts to connect to this AP, and eventually wpa_s will + * blacklist the AP... + */ + if (vif->bss_conf.beacon_int < 16) { + IWL_ERR(priv, + "AP %pM beacon interval is %d, refusing due to firmware bug!\n", + sta->addr, vif->bss_conf.beacon_int); + ret = -EINVAL; + goto out_unlock; + } op = ADD; - else if (old_state == IEEE80211_STA_NONE && + } else if (old_state == IEEE80211_STA_NONE && new_state == IEEE80211_STA_NOTEXIST) op = REMOVE; else if (old_state == IEEE80211_STA_AUTH && @@ -856,6 +870,7 @@ static int iwlagn_mac_sta_state(struct ieee80211_hw *hw, if (iwl_is_rfkill(priv)) ret = 0; +out_unlock: mutex_unlock(&priv->mutex); IWL_DEBUG_MAC80211(priv, "leave\n"); -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/