From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Maoyi Xie <maoyixie.tju@gmail.com>
Cc: Felix Fietkau <nbd@nbd.name>, Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-wireless@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH] wifi: mt76: sdio: check the RX packet length in mt76s_rx_run_queue()
Date: Fri, 20 Nov 2026 09:40:01 +0100 [thread overview]
Message-ID: <awAHYUeQXyiItg_3@lore-qca> (raw)
In-Reply-To: <CAHPEe=FFgzM3L9aiBNczg2AQ4JiG-p+eFKLemjrOMzekuBmHpg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]
On Nov 20, Maoyi Xie wrote:
> Hi Lorenzo,
>
> On Thu, Nov 19, 2026 at 05:49:53PM +0100, Lorenzo Bianconi wrote:
> > I do not think this patch is correct since we actually consume just len -
> > MT_SKB_HEAD_LEN bytes at most, right? I guess we should add something similar
> > to the patch below, what do you think?
>
> Thanks for looking at this.
>
> The fragment is len - MT_SKB_HEAD_LEN bytes, yes. But
> mt76s_build_rx_skb() first copies up to MT_SKB_HEAD_LEN bytes from buf
> into the skb head, so a frame still needs all len bytes between buf and
> end.
ack, you right.
>
> > + if (data_len > len && data_len - len > buf_len)
> > + return NULL;
>
> The caller passes buf_len = round_up(data_len + 4, 4), so this check
> never triggers. With it applied, my harness still reports the same
> reads past the buffer.
>
> Also, rx_check() runs before mt76s_build_rx_skb(). For a TXS frame,
> mt7921_rx_check() and mt7615_rx_check() walk the records up to
> rxd + len / 4, which a check in mt76s_build_rx_skb() cannot cover.
>
> So I think we should keep the check before rx_check(), as in this
> patch. Frames that fit are not affected, and the loop already ends at
> a frame that does not fit.
ack, I agree. Thx for fixing it.
Regards,
Lorenzo
>
> Thanks,
> Maoyi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2026-11-20 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 12:49 [PATCH] wifi: mt76: sdio: check the RX packet length in mt76s_rx_run_queue() Maoyi Xie
2026-11-19 16:49 ` Lorenzo Bianconi
2026-11-20 7:23 ` Maoyi Xie
2026-11-20 8:40 ` Lorenzo Bianconi [this message]
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=awAHYUeQXyiItg_3@lore-qca \
--to=lorenzo@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=maoyixie.tju@gmail.com \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--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