From: Yi Cong <cong.yi@linux.dev>
To: Jes.Sorensen@gmail.com
Cc: linux-wireless@vger.kernel.org, Yi Cong <yicong@kylinos.cn>,
stable@vger.kernel.org
Subject: [PATCH] wifi: rtl8xxxu: fix potential use of uninitialized value
Date: Fri, 27 Feb 2026 15:37:08 +0800 [thread overview]
Message-ID: <20260227073708.508772-1-cong.yi@linux.dev> (raw)
From: Yi Cong <yicong@kylinos.cn>
The local variables 'mcs' and 'nss' in rtl8xxxu_update_ra_report() are
passed to rtl8xxxu_desc_to_mcsrate() as output parameters. If the helper
function encounters an unhandled rate index, it may return without setting
these values, leading to the use of uninitialized stack data.
Initialize 'mcs' to 0 and 'nss' to 1 at declaration to ensure safe defaults
(MCS 0, 1 spatial stream) are used even if parsing fails. Note that 'nss'
must be at least 1 to be valid.
Fixes: 7de16123d9e2 ("wifi: rtl8xxxu: Introduce rtl8xxxu_update_ra_report")
Cc: stable@vger.kernel.org
Signed-off-by: Yi Cong <yicong@kylinos.cn>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 794187d28caa..d0035960f8d4 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -4820,7 +4820,7 @@ static void rtl8xxxu_set_aifs(struct rtl8xxxu_priv *priv, u8 slot_time)
void rtl8xxxu_update_ra_report(struct rtl8xxxu_ra_report *rarpt,
u8 rate, u8 sgi, u8 bw)
{
- u8 mcs, nss;
+ u8 mcs = 0, nss = 1;
rarpt->txrate.flags = 0;
--
2.25.1
next reply other threads:[~2026-02-27 7:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 7:37 Yi Cong [this message]
2026-03-02 7:23 ` [PATCH] wifi: rtl8xxxu: fix potential use of uninitialized value 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=20260227073708.508772-1-cong.yi@linux.dev \
--to=cong.yi@linux.dev \
--cc=Jes.Sorensen@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yicong@kylinos.cn \
/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