From: Luka Gejak <luka.gejak@linux.dev>
To: Greg KH <gregkh@linuxfoundation.org>, Dan Carpenter <error27@gmail.com>
Cc: Alexandru Hossu <hossu.alexandru@gmail.com>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, luka.gejak@linux.dev
Subject: Re: [PATCH v2 1/2] staging: rtl8723bs: fix OOB write in HT_caps_handler()
Date: Mon, 27 Apr 2026 16:32:06 +0200 [thread overview]
Message-ID: <A9FE9889-BAF5-48A0-A3BA-564A0529AF39@linux.dev> (raw)
In-Reply-To: <2026042713-buffing-recite-c3d7@gregkh>
On April 27, 2026 3:11:28 PM GMT+02:00, Greg KH <gregkh@linuxfoundation.org> wrote:
>On Mon, Apr 27, 2026 at 03:58:23PM +0300, Dan Carpenter wrote:
>> On Mon, Apr 27, 2026 at 05:11:19AM -0600, Greg KH wrote:
>> > On Mon, Apr 27, 2026 at 12:48:38PM +0300, Dan Carpenter wrote:
>> > > On Mon, Apr 27, 2026 at 02:28:39AM -0700, Alexandru Hossu wrote:
>> > > > On Mon, Apr 27, 2026 at 11:17 AM, Dan Carpenter wrote:
>> > > > > We need a little change log here. I was hoping you would provide
>> > > > > a link to the AI review in the changelog.
>> > > >
>> > > > Hi Dan,
>> > > >
>> > > > Sorry about the missing changelog, will add it in v3.
>> > > >
>> > > > For the AI review link, I don't have a direct link to the bot output.
>> > > > What I know is from Greg's reply in the v1 thread on lore.kernel.org,
>> > >
>> > > What about a link to the email on lore?
>> >
>> > Sorry, I was on a plane with no connectivity to look it up, here's the
>> > AI review for my patch:
>> > https://sashiko.dev/#/patchset/2026041408-grill-mahogany-d1e3%40gregkh
>> >
>>
>> Ah. Very good. That's fair enough then. The AI is very convincing.
>
>Yes, but is it correct? That's the problem with these tools :)
>
Hi Greg, Dan,
I have reviewed this patch. While it successfully prevents the oob
write, it unfortunately introduces a functional regression. By
enforcing if (pIE->length > sizeof(pmlmeinfo->HT_caps)) and returning
early, the driver bypasses setting pmlmeinfo->HT_caps_enable = 1;. If
future 802.11 standards (or non-standard vendors) append extra bytes
to the ht capability ie, completely discarding the ie will silently
disable high throughput mode and degrade performance. To fix the oob
write without breaking functionality, a better approach would be using
min_t() to cap the length and only process the valid portion.
Separately, while auditing this path, I noticed two pre-existing oob
read vulnerabilities:
1. The GET_HT_CAPABILITY_ELE_RX_STBC(pIE->data) macro
(drivers/staging/rtl8723bs/include/rtw_ht.h:81) unconditionally reads
from pIE->data[1]. If a malicious packet provides a pIE->length of 0
or 1, the driver will blindly read past the end of the ie's data.
2. In OnAssocRsp() (drivers/staging/rtl8723bs/core/rtw_mlme_ext.c),
the ie iteration loop for (i = ...; i < pkt_len;) does not verify
if i + 2 <= pkt_len or if i + 2 + pIE->length <= pkt_len before
invoking handlers. Therefore, pIE->data isn't guaranteed to be bounded
within the received packet buffer, allowing oob reads simply by
overflowing pkt_len from the air.
I recommend revising this patch to use min_t() to avoid the ht mode
regression. Since the oob reads are pre-existing issues outside the
scope of fixing this oob write, they should be addressed in separate
patches, which I am happy to submit :).
Best regards,
Luka Gejak
next prev parent reply other threads:[~2026-04-27 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260427081748.3407939-1-hossu.alexandru@gmail.com>
2026-04-27 8:17 ` [PATCH v2 1/2] staging: rtl8723bs: fix OOB write in HT_caps_handler() Alexandru Hossu
2026-04-27 9:17 ` Dan Carpenter
2026-04-27 9:28 ` Alexandru Hossu
2026-04-27 9:48 ` Dan Carpenter
2026-04-27 11:11 ` Greg KH
2026-04-27 12:58 ` Dan Carpenter
2026-04-27 13:11 ` Greg KH
2026-04-27 14:32 ` Luka Gejak [this message]
2026-04-27 14:45 ` Dan Carpenter
2026-04-27 14:48 ` Dan Carpenter
2026-04-27 8:17 ` [PATCH v2 2/2] staging: rtl8723bs: fix OOB read in OnAssocRsp() IE loop Alexandru Hossu
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=A9FE9889-BAF5-48A0-A3BA-564A0529AF39@linux.dev \
--to=luka.gejak@linux.dev \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hossu.alexandru@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--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