[PATCH] wifi: mt76: sdio: check the RX packet length in mt76s_rx_run_queue()
Lorenzo Bianconi
lorenzo at kernel.org
Fri Nov 20 00:40:01 PST 2026
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20261120/edbed9fb/attachment.sig>
More information about the Linux-mediatek
mailing list