[PATCH mt76] wifi: mt76: mt76x02: only read QoS control for QoS data frames

David Bauer mail at david-bauer.net
Mon Nov 2 16:45:52 PST 2026


Only read the QoS control field for received QoS data frames.
For any other frame the pointer might refer to bytes beyond
the 802.11 header, so the read picks up payload bytes or runs
past the end of the frame.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index 457767bbd8b60..3a08b57bd8de3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -897,10 +897,12 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
 	status->freq = dev->mphy.chandef.chan->center_freq;
 	status->band = dev->mphy.chandef.chan->band;
 
-	hdr = (struct ieee80211_hdr *)skb->data;
-	status->qos_ctl = *ieee80211_get_qos_ctl(hdr);
 	status->seqno = FIELD_GET(MT_RXWI_SN, tid_sn);
 
+	hdr = (struct ieee80211_hdr *)skb->data;
+	if (ieee80211_is_data_qos(hdr->frame_control))
+		status->qos_ctl = *ieee80211_get_qos_ctl(hdr);
+
 	return mt76x02_mac_process_rate(dev, status, rate);
 }
 
-- 
2.53.0




More information about the linux-arm-kernel mailing list