Commit 7360cdec authored by Felix Fietkau's avatar Felix Fietkau

mt76: do not access 802.11 header in ccmp check for 802.3 rx skbs

Avoids false positive on detecting frags or encrypted mgmt frames
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent a1b0bbd4
...@@ -974,6 +974,10 @@ mt76_check_ccmp_pn(struct sk_buff *skb) ...@@ -974,6 +974,10 @@ mt76_check_ccmp_pn(struct sk_buff *skb)
if (!wcid || !wcid->rx_check_pn) if (!wcid || !wcid->rx_check_pn)
return 0; return 0;
security_idx = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK;
if (status->flag & RX_FLAG_8023)
goto skip_hdr_check;
hdr = mt76_skb_get_hdr(skb); hdr = mt76_skb_get_hdr(skb);
if (!(status->flag & RX_FLAG_IV_STRIPPED)) { if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
/* /*
...@@ -994,9 +998,8 @@ mt76_check_ccmp_pn(struct sk_buff *skb) ...@@ -994,9 +998,8 @@ mt76_check_ccmp_pn(struct sk_buff *skb)
if (ieee80211_is_mgmt(hdr->frame_control) && if (ieee80211_is_mgmt(hdr->frame_control) &&
!ieee80211_has_tods(hdr->frame_control)) !ieee80211_has_tods(hdr->frame_control))
security_idx = IEEE80211_NUM_TIDS; security_idx = IEEE80211_NUM_TIDS;
else
security_idx = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK;
skip_hdr_check:
BUILD_BUG_ON(sizeof(status->iv) != sizeof(wcid->rx_key_pn[0])); BUILD_BUG_ON(sizeof(status->iv) != sizeof(wcid->rx_key_pn[0]));
ret = memcmp(status->iv, wcid->rx_key_pn[security_idx], ret = memcmp(status->iv, wcid->rx_key_pn[security_idx],
sizeof(status->iv)); sizeof(status->iv));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment