Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2718055pxv; Sun, 11 Jul 2021 23:41:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKOHglgSvkDTbx251bDkMzOXRMY3vkfzGZyT0S16D/1xUQcFm/kDRx9gkTXJjeOVqOuquw X-Received: by 2002:a17:906:2cc5:: with SMTP id r5mr50571004ejr.454.1626072117046; Sun, 11 Jul 2021 23:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626072117; cv=none; d=google.com; s=arc-20160816; b=JMX9V+B2t839DhVhTLhljYTJmNw6o+wgqfNeu2ZNUBT0xUrCEXFsRGfVyS3dewkgVE Qw1SISvDIjcbz4UKHPAFuL6gATLAE7Zvs+BoWGggAlCsqHlmp0CLWGJp2w2YDJ3z2IZQ GAXy9O6EpubjU94pXQ3l8zC92X1wwN7TolLgNuyngLoSKs+a4aJIQ8avR0Ax8Q5zAD4e NQydWodUP0pfhfs/+ljNV4l0qQPoVhDIbn4fnBgNY3N1wXZN+gsnCPxT3ZJ6wJPeAvHh mSLfjvEFtbGKKnoC9HUcPt0mQdG7pK7qrMaPaY9QxxHGmH972kCb5RSjA6ES2/d710xO 51Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LcldxvKWCObfMdjHqquZ/bFY5hu8CU5QESZmIIfCoqA=; b=aRVv64RbSLuN1azHHoYH0FHYfMMSQYI04PESWiDt3qSTcopAagac5nrjtBzTNe4Lck 9wM49OLoTojdLdSvhyIM43DHkL+qarZW5AGn4n2iWIMS0NrW0Xy5b3oFKJsghS+tNpaX zkZiZ3sS1+YzTIxm1Bsq/HkCMeNOwc+vulZFbQsPtFb5nwdrgEeumfvc0Wta+a3I5M0u Q0gZAQNfLwYu0apkx4EHmUT2CdNbWoG3qjhandKciEr5oREopPtGs6XUJIsrsAr//3RG b2XWBuM9oNyoZLuRuTBXqCFf99E1nbvOvJzakpRyXfb1aUzsLpC+9HDn+k7F1YwT7wXn RdjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t6LFdehB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm13si1330912ejc.590.2021.07.11.23.41.34; Sun, 11 Jul 2021 23:41:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t6LFdehB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237990AbhGLGn3 (ORCPT + 99 others); Mon, 12 Jul 2021 02:43:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:53450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237653AbhGLGen (ORCPT ); Mon, 12 Jul 2021 02:34:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E2BA61175; Mon, 12 Jul 2021 06:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071473; bh=8xG8nUNhpybY9cQUvP2T6D9544SiSdMnpuMukcWwowg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t6LFdehBn6cJXu0k5zO7XIrf4ZRKO1VXROC25uhgxUhwZfLJ7OpyqNOCwP/j65/lg HKaNFJRW95nDT09KE9+E2fD9veBdw2naaZPM2h+FwNQpxshu9rjgaHti2GpWLxFVKi TXGs0MPwiRokA8gFCcv7aRop9j9ztPu6HPsvz/WE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Fuzzey , Kalle Valo Subject: [PATCH 5.10 085/593] rsi: fix AP mode with WPA failure due to encrypted EAPOL Date: Mon, 12 Jul 2021 08:04:05 +0200 Message-Id: <20210712060852.508250757@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Fuzzey commit 314538041b5632ffaf64798faaeabaf2793fe029 upstream. In AP mode WPA2-PSK connections were not established. The reason was that the AP was sending the first message of the 4 way handshake encrypted, even though no pairwise key had (correctly) yet been set. Encryption was enabled if the "security_enable" driver flag was set and encryption was not explicitly disabled by IEEE80211_TX_INTFL_DONT_ENCRYPT. However security_enable was set when *any* key, including the AP GTK key, had been set which was causing unwanted encryption even if no key was avaialble for the unicast packet to be sent. Fix this by adding a check that we have a key and drop the old security_enable driver flag which is insufficient and redundant. The Redpine downstream out of tree driver does it this way too. Regarding the Fixes tag the actual code being modified was introduced earlier, with the original driver submission, in dad0d04fa7ba ("rsi: Add RS9113 wireless driver"), however at that time AP mode was not yet supported so there was no bug at that point. So I have tagged the introduction of AP support instead which was part of the patch set "rsi: support for AP mode" [1] It is not clear whether AP WPA has ever worked, I can see nothing on the kernel side that broke it afterwards yet the AP support patch series says "Tests are performed to confirm aggregation, connections in WEP and WPA/WPA2 security." One possibility is that the initial tests were done with a modified userspace (hostapd). [1] https://www.spinics.net/lists/linux-wireless/msg165302.html Signed-off-by: Martin Fuzzey Fixes: 38ef62353acb ("rsi: security enhancements for AP mode") CC: stable@vger.kernel.org Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1622564459-24430-1-git-send-email-martin.fuzzey@flowbird.group Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/rsi/rsi_91x_hal.c | 2 +- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 3 --- drivers/net/wireless/rsi/rsi_91x_mgmt.c | 3 +-- drivers/net/wireless/rsi/rsi_main.h | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) --- a/drivers/net/wireless/rsi/rsi_91x_hal.c +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c @@ -203,7 +203,7 @@ int rsi_prepare_data_desc(struct rsi_com wh->frame_control |= cpu_to_le16(RSI_SET_PS_ENABLE); if ((!(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) && - (common->secinfo.security_enable)) { + info->control.hw_key) { if (rsi_is_cipher_wep(common)) ieee80211_size += 4; else --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c @@ -1028,7 +1028,6 @@ static int rsi_mac80211_set_key(struct i mutex_lock(&common->mutex); switch (cmd) { case SET_KEY: - secinfo->security_enable = true; status = rsi_hal_key_config(hw, vif, key, sta); if (status) { mutex_unlock(&common->mutex); @@ -1047,8 +1046,6 @@ static int rsi_mac80211_set_key(struct i break; case DISABLE_KEY: - if (vif->type == NL80211_IFTYPE_STATION) - secinfo->security_enable = false; rsi_dbg(ERR_ZONE, "%s: RSI del key\n", __func__); memset(key, 0, sizeof(struct ieee80211_key_conf)); status = rsi_hal_key_config(hw, vif, key, sta); --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c @@ -1803,8 +1803,7 @@ int rsi_send_wowlan_request(struct rsi_c RSI_WIFI_MGMT_Q); cmd_frame->desc.desc_dword0.frame_type = WOWLAN_CONFIG_PARAMS; cmd_frame->host_sleep_status = sleep_status; - if (common->secinfo.security_enable && - common->secinfo.gtk_cipher) + if (common->secinfo.gtk_cipher) flags |= RSI_WOW_GTK_REKEY; if (sleep_status) cmd_frame->wow_flags = flags; --- a/drivers/net/wireless/rsi/rsi_main.h +++ b/drivers/net/wireless/rsi/rsi_main.h @@ -151,7 +151,6 @@ enum edca_queue { }; struct security_info { - bool security_enable; u32 ptk_cipher; u32 gtk_cipher; };