From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Feng Ning" <feng@innora.ai>, <gregkh@linuxfoundation.org>
Cc: <linux-staging@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: rtl8723bs: fix heap buffer overflow in cfg80211_rtw_add_key
Date: Mon, 13 Apr 2026 16:31:52 +0200 [thread overview]
Message-ID: <DHS3M1KRGUSB.3O6K3J3LSC83A@linux.dev> (raw)
In-Reply-To: <adQ4yU-Pc0uHXtb5@ans-MacBook-Pro.local>
On Tue Apr 7, 2026 at 12:50 AM CEST, Feng Ning wrote:
> From: Feng Ning <feng@innora.ai>
> To: gregkh@linuxfoundation.org
> Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
> Subject: [PATCH] staging: rtl8723bs: fix heap buffer overflow in cfg80211_rtw_add_key
>
> The cfg80211 framework allows key sequence counters (NL80211_KEY_SEQ)
> up to 16 bytes, but ieee_param.crypt.seq is a fixed 8-byte buffer.
> When cfg80211_rtw_add_key() copies the sequence counter via memcpy()
> without checking seq_len, a heap buffer overflow of up to 8 bytes
> occurs, overwriting adjacent fields key_len and key[].
>
> Cap the copy length at the buffer size using min_t().
>
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
> Signed-off-by: Feng Ning <feng@innora.ai>
> ---
> drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 7cb0c6f22..4fba53c2d 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -883,8 +883,11 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
>
> param->u.crypt.idx = key_index;
>
> - if (params->seq_len && params->seq)
> - memcpy(param->u.crypt.seq, (u8 *)params->seq, params->seq_len);
> + if (params->seq_len && params->seq) {
> + size_t seq_copy = min_t(size_t, params->seq_len,
> + sizeof(param->u.crypt.seq));
> + memcpy(param->u.crypt.seq, (u8 *)params->seq, seq_copy);
> + }
>
> if (params->key_len && params->key) {
> param->u.crypt.key_len = params->key_len;
Hi Feng,
one quick question, why did you send same patch as before? If it is
because it hasn't been merged yet please wait because it is currently
merge window and we are not accepting any new patches. We will come to
your patch eventually, just be patient.
Best regards,
Luka Gejak
next prev parent reply other threads:[~2026-04-13 14:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 22:50 [PATCH] staging: rtl8723bs: fix heap buffer overflow in cfg80211_rtw_add_key Feng Ning
2026-04-13 14:31 ` Luka Gejak [this message]
2026-04-14 6:56 ` Feng Ning
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=DHS3M1KRGUSB.3O6K3J3LSC83A@linux.dev \
--to=luka.gejak@linux.dev \
--cc=feng@innora.ai \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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