Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] wifi: mt76: mt7925: drop RX frame with a header gap past its end
@ 2026-11-27  8:41 Eason Lai
  0 siblings, 0 replies; only message in thread
From: Eason Lai @ 2026-11-27  8:41 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
	quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai, eason.lai

hdr_gap includes the header padding from the RXD, but is not checked
against skb->len. If it is too large, skb_pull() fails and leaves no
headroom, so the __skb_push() in mt76_insert_ccmp_hdr() writes before
skb->head.

Drop the frame if hdr_gap is not within the skb.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Eason Lai <eason.lai@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
index 3389a3236187..b5eae71c5285 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
@@ -599,6 +599,9 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb)
 	}
 
 	hdr_gap = (u8 *)rxd - skb->data + 2 * remove_pad;
+	if (hdr_gap >= skb->len)
+		return -EINVAL;
+
 	if (hdr_trans && ieee80211_has_morefrags(fc)) {
 		if (mt7925_reverse_frag0_hdr_trans(skb, hdr_gap))
 			return -EINVAL;
-- 
2.45.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-27  8:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  8:41 [PATCH v1] wifi: mt76: mt7925: drop RX frame with a header gap past its end Eason Lai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox