[PATCH] wifi: mt76: sdio: check the RX packet length in mt76s_rx_run_queue()
Maoyi Xie
maoyixie.tju at gmail.com
Thu Nov 19 23:23:21 PST 2026
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.
> + 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.
Thanks,
Maoyi
More information about the Linux-mediatek
mailing list