Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Zhao Li <enderaoelyther@gmail.com>
Cc: Hemanth Selam <hemanth.selam@gmail.com>,
	Morning Star <alexbestoso@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH rtw-next 1/3] wifi: rtlwifi: rtl8192ce: don't mark unencrypted frames as decrypted
Date: Mon, 23 Nov 2026 06:14:37 +0000	[thread overview]
Message-ID: <ee07e9227ef54a6ca5520f7bd80c0f95@realtek.com> (raw)
In-Reply-To: <20261121163547.37019-2-enderaoelyther@gmail.com>

Zhao Li <enderaoelyther@gmail.com> wrote:
> The receive descriptor's SWDEC bit is set when a frame still needs
> software decryption. It is also clear for a frame that was never
> encrypted. rtl92ce_rx_query_desc() nevertheless sets RX_FLAG_DECRYPTED
> for every frame with SWDEC clear except a protected robust management
> frame, including unprotected data and management frames.

This is what the comment says, but you are going to remove.

> 
> mac80211 then accepts an unprotected unicast data frame although a
> pairwise key is installed, because ieee80211_drop_unencrypted() passes
> frames marked as decrypted, and it accepts unprotected deauthentication
> and disassociation frames on a connection that uses management frame
> protection. A station in radio range can therefore inject plaintext
> data into an encrypted connection, or end a protected one, by spoofing
> the peer's address.

For data frame, will hardware fail to do decryption and flag sw dec?

> 
> Set the flag only for a protected frame that is not a robust management
> frame, as the rtl8188ee, rtl8192ee, rtl8723ae, rtl8723be and rtl8821ae
> drivers do. 

I think the purpose of this patch is to align the behavior of all chips,
right?

Maybe, we can just move the chunk setting RX_FLAG_DECRYPTED into an 
inline function, and all chips call it.

The commit subject/message can be simple that 
"Unify the setting of RX_FLAG_DECRYPTED". 

> rtw88 dropped the same assumption in commit 0649ff58a0f6
> ("rtw88: Don't set RX_FLAG_DECRYPTED if packet has no encryption").

The commit is to add missed ENC type, but 8192ce doesn't have the field, no?

> 
> Found by code review. Compile-tested with W=1.
> 
> Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
> ---
> No new W=1, sparse or smatch warnings.
> 
> 834fc28d7880 (7.4-rc1) fixed "managment" in the comment this patch removes;
> with the old spelling in the removed lines it applies to 5.10.y through 7.3.y.
> 
> AI assistance was used.
> 
>  .../wireless/realtek/rtlwifi/rtl8192ce/trx.c    | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
> index 99472053ccff..3d11ddf86136 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
> @@ -300,20 +300,13 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
> 
>         rx_status->flag |= RX_FLAG_MACTIME_START;
> 
> -       /* hw will set stats->decrypted true, if it finds the
> -        * frame is open data frame or mgmt frame.
> -        * So hw will not decryption robust management frame
> -        * for IEEE80211w but still set status->decrypted
> -        * true, so here we should set it back to undecrypted
> -        * for IEEE80211w frame, and mac80211 sw will help
> -        * to decrypt it
> -        */
> +       /* SWDEC is clear for plaintext too; mac80211 decrypts robust mgmt */
>         if (stats->decrypted) {
> -               if ((_ieee80211_is_robust_mgmt_frame(hdr)) &&
> -                   (ieee80211_has_protected(hdr->frame_control)))
> -                       rx_status->flag &= ~RX_FLAG_DECRYPTED;
> -               else
> +               if (ieee80211_has_protected(hdr->frame_control) &&
> +                   !_ieee80211_is_robust_mgmt_frame(hdr))
>                         rx_status->flag |= RX_FLAG_DECRYPTED;
> +               else
> +                       rx_status->flag &= ~RX_FLAG_DECRYPTED;
>         }


The subject "wifi: rtlwifi: rtl8192ce: don't mark unencrypted frames as decrypted" 
isn't clear to me. Which one is 'unencrypted'? and which one is 'decrypted' ?

>         /* rate_idx: index of data rate into band's
>          * supported rates or MCS index if HT rates
> --
> 2.56.1


  reply	other threads:[~2026-11-23  6:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261121163547.37019-1-enderaoelyther@gmail.com>
2026-11-21 16:35 ` [PATCH rtw-next 1/3] wifi: rtlwifi: rtl8192ce: don't mark unencrypted frames as decrypted Zhao Li
2026-11-23  6:14   ` Ping-Ke Shih [this message]
2026-11-21 16:35 ` [PATCH rtw-next 2/3] wifi: rtlwifi: rtl8192se: " Zhao Li
2026-11-21 16:35 ` [PATCH rtw-next 3/3] wifi: rtlwifi: rtl8192cu: don't mark undecrypted " Zhao Li
2026-11-23  6:22   ` Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee07e9227ef54a6ca5520f7bd80c0f95@realtek.com \
    --to=pkshih@realtek.com \
    --cc=alexbestoso@gmail.com \
    --cc=enderaoelyther@gmail.com \
    --cc=hemanth.selam@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox