From patchwork Mon Mar 9 13:24:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5967441 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9A0ABF440 for ; Mon, 9 Mar 2015 13:26:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2EC120254 for ; Mon, 9 Mar 2015 13:26:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F15DC2024F for ; Mon, 9 Mar 2015 13:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753409AbbCIN0f (ORCPT ); Mon, 9 Mar 2015 09:26:35 -0400 Received: from mail-la0-f41.google.com ([209.85.215.41]:33008 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752807AbbCIN0e (ORCPT ); Mon, 9 Mar 2015 09:26:34 -0400 Received: by labmn12 with SMTP id mn12so8871079lab.0 for ; Mon, 09 Mar 2015 06:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=xoPvWKIcDz5K6lbT5TXs4rGII/qY4GPVhFrN7d5zZMI=; b=X1pAmJtmEoNhbc6YN5QcsouxL7+OQTHUXT73qUutTml7UJQ//kGznyh2GPi2N76+Zi RVUxgkSu+Lhk3surD+/HQzqh13qShH6ChCUWfkV+9qpfSW5BEw8ViD3ZQfxmoMGFQYHZ 6kJkj6hpgRByoI5YBKuxw22nBL8UYoilis6is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xoPvWKIcDz5K6lbT5TXs4rGII/qY4GPVhFrN7d5zZMI=; b=Bg7EeE2ANxS16fqTd9lLKC92sNRYiGjKeLMfVtRY+WStbPE5zlZT5tGb2BLAHNhYIH BN/UJxSBjOgfnEOmDJ59ZUSYKRGuKWq7VFF5LxlFEdAKvX2I+d0FNpJKvi/LahmPe6w3 07YjbJco1Y6di7+aKUOE7Oi1s8uymzxbYnr1vwhhQsXqrD8UhNijwdY1gDrkkZQc+gOt T/xn35vEr96jYmCIP6Aerh4S89lp4oe5emGao9jjA6auJhQ4C4jlIPNrHu3R4X9++tMx Pf5Xb0ttA2Cu+FYZyLJLXCWA+pm/KM/jEqaKJY/5okStPOdLJn+AbKLACUEX2/IPXDqT dYXQ== X-Gm-Message-State: ALoCoQkbFLcM9ATGHfplH3wwwEBJz6sKxoUxqqrlS2GuwzBcs8G2A9DYslkYu07O46F+bPrJQWMOqvl/GCe4GPvLsCR9/m+sYRtRMOKQQojatBXUbKLMSx78PoK/9nCM7RtkGkFFwG92 X-Received: by 10.112.140.38 with SMTP id rd6mr25477108lbb.116.1425907593446; Mon, 09 Mar 2015 06:26:33 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id rz10sm100197lbb.46.2015.03.09.06.26.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Mar 2015 06:26:32 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH] ath10k: fix WPA crypto Date: Mon, 9 Mar 2015 14:24:17 +0100 Message-Id: <1425907457-15118-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP My recent patch `ath10k: fix broken traffic for 802.1x in client mode` introduced a regression on WPA crypto. All keys were treated as if they were WEP which resulted in WPA being incorrectly installed to fw/hw and subsequently no traffic. Reported-by: Marek Puzyniak Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 1138f4f..d65a146 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4028,6 +4028,11 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, } } + if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) + flags |= WMI_KEY_PAIRWISE; + else + flags |= WMI_KEY_GROUP; + if (is_wep) { if (cmd == SET_KEY) arvif->wep_keys[key->keyidx] = key; @@ -4053,29 +4058,24 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, */ if (cmd == SET_KEY && arvif->def_wep_key_idx == -1) flags |= WMI_KEY_TX_USAGE; - } - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - flags |= WMI_KEY_PAIRWISE; - else - flags |= WMI_KEY_GROUP; - - /* mac80211 uploads static WEP keys as groupwise while fw/hw requires - * pairwise keys for non-self peers, i.e. BSSID in STA mode and - * associated stations in AP/IBSS. - * - * Static WEP keys for peer_addr=vif->addr and 802.1X WEP keys work - * fine when mapped directly from mac80211. - * - * Note: When installing first static WEP groupwise key (which should - * be pairwise) def_wep_key_idx isn't known yet (it's equal to -1). - * Since .set_default_unicast_key is called only for static WEP it's - * used to re-upload the key as pairwise. - */ - if (arvif->def_wep_key_idx >= 0 && - memcmp(peer_addr, arvif->vif->addr, ETH_ALEN)) { - flags &= ~WMI_KEY_GROUP; - flags |= WMI_KEY_PAIRWISE; + /* mac80211 uploads static WEP keys as groupwise while fw/hw + * requires pairwise keys for non-self peers, i.e. BSSID in STA + * mode and associated stations in AP/IBSS. + * + * Static WEP keys for peer_addr=vif->addr and 802.1X WEP keys + * work fine when mapped directly from mac80211. + * + * Note: When installing first static WEP groupwise key (which + * should be pairwise) def_wep_key_idx isn't known yet (it's + * equal to -1). Since .set_default_unicast_key is called only + * for static WEP it's used to re-upload the key as pairwise. + */ + if (arvif->def_wep_key_idx >= 0 && + memcmp(peer_addr, arvif->vif->addr, ETH_ALEN)) { + flags &= ~WMI_KEY_GROUP; + flags |= WMI_KEY_PAIRWISE; + } } ret = ath10k_install_key(arvif, key, cmd, peer_addr, flags);