]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
rsi: fix key enabled check causing unwanted encryption for vap_id > 0
authorMartin Fuzzey <martin.fuzzey@flowbird.group>
Mon, 30 Aug 2021 15:26:45 +0000 (17:26 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:48:10 +0000 (09:48 +0100)
BugLink: https://bugs.launchpad.net/bugs/1951822
commit 99ac6018821253ec67f466086afb63fc18ea48e2 upstream.

My previous patch checked if encryption should be enabled by directly
checking info->control.hw_key (like the downstream driver).
However that missed that the control and driver_info members of
struct ieee80211_tx_info are union fields.

Due to this when rsi_core_xmit() updates fields in "tx_params"
(driver_info) it can overwrite the control.hw_key, causing the result
of the later test to be incorrect.

With the current structure layout the first byte of control.hw_key is
overlayed with the vap_id so, since we only test if control.hw_key is
NULL / non NULL, a non zero vap_id will incorrectly enable encryption.

In basic STA and AP modes the vap_id is always zero so it works but in
P2P client mode a second VIF is created causing vap_id to be non zero
and hence encryption to be enabled before keys have been set.

Fix this by extracting the key presence flag to a new field in the driver
private tx_params structure and populating it first.

Fixes: 314538041b56 ("rsi: fix AP mode with WPA failure due to encrypted EAPOL")
Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
CC: stable@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1630337206-12410-3-git-send-email-martin.fuzzey@flowbird.group
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/wireless/rsi/rsi_91x_core.c
drivers/net/wireless/rsi/rsi_91x_hal.c
drivers/net/wireless/rsi/rsi_main.h

index a48e616e0fb916ba1d36c7c2349cd5e5255a3a1a..6bfaab48b507de8d87f9804e4cdde8389b816ef2 100644 (file)
@@ -399,6 +399,8 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb)
 
        info = IEEE80211_SKB_CB(skb);
        tx_params = (struct skb_info *)info->driver_data;
+       /* info->driver_data and info->control part of union so make copy */
+       tx_params->have_key = !!info->control.hw_key;
        wh = (struct ieee80211_hdr *)&skb->data[0];
        tx_params->sta_id = 0;
 
index f4a26f16f00f445912a81d417349d76d6888741d..2aa9f0b1283964d1a939efa03ec93f15db98b0f5 100644 (file)
@@ -203,7 +203,7 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
                wh->frame_control |= cpu_to_le16(RSI_SET_PS_ENABLE);
 
        if ((!(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) &&
-           info->control.hw_key) {
+           tx_params->have_key) {
                if (rsi_is_cipher_wep(common))
                        ieee80211_size += 4;
                else
index a3e4fd5bd3e92c5ef1a263a5ccda452bf77fa629..810485a3c85a9fea5670590371f95f6c97870f58 100644 (file)
@@ -139,6 +139,7 @@ struct skb_info {
        u8 internal_hdr_size;
        struct ieee80211_vif *vif;
        u8 vap_id;
+       bool have_key;
 };
 
 enum edca_queue {