From patchwork Wed Jun 20 07:58:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 139288 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp470536lji; Wed, 20 Jun 2018 00:58:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIsOp5WjQri6tknWOMsOaOYnT3u+o9aS/5knT1gpvKbVcGBMN9LfuzetKwi4S98cGqCUpw8 X-Received: by 2002:a63:7986:: with SMTP id u128-v6mr17338679pgc.273.1529481529246; Wed, 20 Jun 2018 00:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529481529; cv=none; d=google.com; s=arc-20160816; b=tGRfYqYhyCZL3MOf3QG26yh2N4KJFhNWX+A9jCC/s2+gXVWF5W1nKEbzqz7CVMVx5B 2qM0yr9nUQwBZdoINf4HXVxwKJNJpU0rSjsL0TIv5D1MkRWlNhyXe9npJnspl6iPN/uR xHKg9JvCxhlfXuXBJBhKonXBwldWv7jSgN96RZX4IwwGp1BHabtv03e7c4gl3jcIjEI4 WRJ8IKe4PgJ3Yv/tmrDJJYoVg6aC9miS0cQ+F/xKzlB4xdGkptTx5pASZIQGiKsqggb5 z2qkJVExIM8rwwF6gJ28INhxo8CECNsgkKx88pgTCZbm/2UgjBxqeOYfM+qUF1HBt7ct ryAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature:arc-authentication-results; bh=fjscbWPhm3M+jRmZaLsYoIWF7ps5Jr2fML+T8uVvMec=; b=xljzH4Mb8oGQXRX/yOg9PegApBYv9KQUeyicyHilUxuv3YVFRP2JuNcS6RlYSozd9m 7r0+56XoAr/sSTaBFReZ3GEdW7/qk/T8LP6SraCGSfc7apIC5FUXxtfe2zH5x379TPnE H7XgVkioYA96Zo06ND5C1JsW5E5BvpUVVFVdfBu8xcMstBwspnyjlfBMAYjUT/KCUYpj 2PNk2jIM7Wu93xj/1UYvsou8VagkBU17KLNRiROmskh+kO9dZW2PJGqikwgGwUvogO+t BvWlINw9o67NA3JGt4T/jekyLkjVZsihPTd6dxCYHFW1VoZU5Ol2TnMnUxWUdYwgVKHK Rlxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=GIxVOXlu; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jiv4hG73; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id q6-v6si1945547plr.134.2018.06.20.00.58.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 00:58:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=GIxVOXlu; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jiv4hG73; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fjscbWPhm3M+jRmZaLsYoIWF7ps5Jr2fML+T8uVvMec=; b=GIxVOXluGy89+TVmLBrOoMgl4s 1ImntL713+WIXHE7iFDqtmeY/T+14OWm5xX6hulQUWIkLgihSk0l34NzJndm2pMzTbGX3Yh4RLywt glhp/Ri11oXf/mzVwvzx7mGdUByqsAEyvnXHw3+gCakTEibMHZPlc0ijUkNKE6k4uOZHWl3J1jE/z cO1wfmbTEV/xSVExWTSRkLdSKSe3S3RVkrMulPZAr9LbeMzOuu/qNn20q9ZA94uBzaPN6+Q1kJB56 0F6YK7maOvR3xxcKLw5mJICVhMSBHdXnXIatmjsyZU9T6c4DphIcA5MJ4cfDgqskt9A3ZPfKqf688 eD6JwpKQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVY0t-00012p-MU; Wed, 20 Jun 2018 07:58:47 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVY0q-00010F-Ly for wcn36xx@lists.infradead.org; Wed, 20 Jun 2018 07:58:46 +0000 Received: by mail-wr0-x242.google.com with SMTP id d2-v6so2197944wrm.10 for ; Wed, 20 Jun 2018 00:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yf4eoyk+uPBcxfnkbDhVhnbqef9PQzkkFTDaIRJuiBQ=; b=Jiv4hG73V4KTzKJF89TNoy3vTxK2at4S240pEPkiBIV0vw5L01KVJKtwfKXBez11GI zgysYcvwKep2Q7zDrMg1EdP354AVugP459MrBj1br1TfK4sz2mlA3/mypbpp7aiS+swI RTKfGXpdpjj4cG+Kz2O10jeAHtEr4Ky16Dc40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yf4eoyk+uPBcxfnkbDhVhnbqef9PQzkkFTDaIRJuiBQ=; b=XIYhix6WpetnDoWaKRzWV2ymddPXBRTDWJz+D7cjY78l98P6naEI6ft4GCC/tU7v0p pXqewys8XPKIMJ7wZgQJc3KlgPu1utv9JnuxWSWGb2oSC82WVfLg/lPrY7/wD92YcZXs H3Rh/y0VQWD0C5goTsujXzo8SI+P+IKiahS90gvQKdFjpie7Brs6jcnyhZF8EJ07sjiO qzeXeKRxHnDwPtbnJvH+CrTIXb3RhiZ/SDTAmIJWMDJujZEYufX4gpR8l11dOBMrV4Jh UaVeHlVuG/Zpnfytxao3S53PjYCVRnEXkwSpPMfi6AgeyJ6eW3Hz1VBZZpQci29rQS+i 7puQ== X-Gm-Message-State: APt69E3Gr3iQz3wlsgj47y3vYw2VR6IaM2AX3hGq+h4hNRr/X0ko8yJN YBpWed9CF2wPWeevQDToUa58xw== X-Received: by 2002:a5d:49d1:: with SMTP id t17-v6mr15676538wrs.242.1529481513103; Wed, 20 Jun 2018 00:58:33 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (LFbn-1-2080-109.w90-76.abo.wanadoo.fr. [90.76.145.109]) by smtp.gmail.com with ESMTPSA id 12-v6sm2806393wmt.19.2018.06.20.00.58.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jun 2018 00:58:32 -0700 (PDT) From: Loic Poulain To: kvalo@codeaurora.org Subject: [PATCH v2 3/3] wcn36xx: Fix WEP encryption Date: Wed, 20 Jun 2018 09:58:00 +0200 Message-Id: <1529481480-13247-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529481480-13247-1-git-send-email-loic.poulain@linaro.org> References: <1529481480-13247-1-git-send-email-loic.poulain@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_005844_732336_F127B0C3 X-CRM114-Status: GOOD ( 12.32 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: wcn36xx@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wcn36xx@lists.infradead.org, Loic Poulain , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org MIME-Version: 1.0 Sender: "wcn36xx" Errors-To: wcn36xx-bounces+patch=linaro.org@lists.infradead.org In case of WEP encryption, driver has to configure shared key for associated station(s). Note that sta pointer is NULL in case of non pairwise key, causing NULL pointer dereference with existing code (sta_priv->is_data_encrypted). Fix this by using associated sta list instead. This enables WEP support as client, WEP AP is non-functional. Signed-off-by: Loic Poulain --- v2: Commit reword, clarify Client/AP WEP status drivers/net/wireless/ath/wcn36xx/main.c | 19 +++++++++++-------- drivers/net/wireless/ath/wcn36xx/smd.c | 20 ++++++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) -- 2.7.4 _______________________________________________ wcn36xx mailing list wcn36xx@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wcn36xx diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 6fd0bf6..e38443e 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -493,7 +493,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); - struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta); + struct wcn36xx_sta *sta_priv = sta ? wcn36xx_sta_to_priv(sta) : NULL; int ret = 0; u8 key[WLAN_MAX_KEY_LEN]; @@ -570,13 +570,16 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, if ((WLAN_CIPHER_SUITE_WEP40 == key_conf->cipher) || (WLAN_CIPHER_SUITE_WEP104 == key_conf->cipher)) { - sta_priv->is_data_encrypted = true; - wcn36xx_smd_set_stakey(wcn, - vif_priv->encrypt_type, - key_conf->keyidx, - key_conf->keylen, - key, - get_sta_index(vif, sta_priv)); + list_for_each_entry(sta_priv, + &vif_priv->sta_list, list) { + sta_priv->is_data_encrypted = true; + wcn36xx_smd_set_stakey(wcn, + vif_priv->encrypt_type, + key_conf->keyidx, + key_conf->keylen, + key, + get_sta_index(vif, sta_priv)); + } } } break; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index b4dadf7..304a86c 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1708,12 +1708,20 @@ int wcn36xx_smd_set_stakey(struct wcn36xx *wcn, msg_body.set_sta_key_params.sta_index = sta_index; msg_body.set_sta_key_params.enc_type = enc_type; - msg_body.set_sta_key_params.key[0].id = keyidx; - msg_body.set_sta_key_params.key[0].unicast = 1; - msg_body.set_sta_key_params.key[0].direction = WCN36XX_HAL_TX_RX; - msg_body.set_sta_key_params.key[0].pae_role = 0; - msg_body.set_sta_key_params.key[0].length = keylen; - memcpy(msg_body.set_sta_key_params.key[0].key, key, keylen); + if (enc_type == WCN36XX_HAL_ED_WEP104 || + enc_type == WCN36XX_HAL_ED_WEP40) { + /* Use bss key for wep (static) */ + msg_body.set_sta_key_params.def_wep_idx = keyidx; + msg_body.set_sta_key_params.wep_type = 0; + } else { + msg_body.set_sta_key_params.key[0].id = keyidx; + msg_body.set_sta_key_params.key[0].unicast = 1; + msg_body.set_sta_key_params.key[0].direction = WCN36XX_HAL_TX_RX; + msg_body.set_sta_key_params.key[0].pae_role = 0; + msg_body.set_sta_key_params.key[0].length = keylen; + memcpy(msg_body.set_sta_key_params.key[0].key, key, keylen); + } + msg_body.set_sta_key_params.single_tid_rc = 1; PREPARE_HAL_BUF(wcn->hal_buf, msg_body);