Skip to content

Commit 65c415a

Browse files
Wen Gongjmberg-intel
authored andcommitted
ath10k: drop fragments with multicast DA for PCIe
Fragmentation is not used with multicast frames. Discard unexpected fragments with multicast DA. This fixes CVE-2020-26145. Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 Cc: [email protected] Signed-off-by: Wen Gong <[email protected]> Signed-off-by: Jouni Malinen <[email protected]> Link: https://lore.kernel.org/r/20210511200110.5a0bd289bda8.Idd6ebea20038fb1cfee6de924aa595e5647c9eae@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent a1166b2 commit 65c415a

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

drivers/net/wireless/ath/ath10k/htt_rx.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,16 @@ static u64 ath10k_htt_rx_h_get_pn(struct ath10k *ar, struct sk_buff *skb,
17681768
return pn;
17691769
}
17701770

1771+
static bool ath10k_htt_rx_h_frag_multicast_check(struct ath10k *ar,
1772+
struct sk_buff *skb,
1773+
u16 offset)
1774+
{
1775+
struct ieee80211_hdr *hdr;
1776+
1777+
hdr = (struct ieee80211_hdr *)(skb->data + offset);
1778+
return !is_multicast_ether_addr(hdr->addr1);
1779+
}
1780+
17711781
static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar,
17721782
struct sk_buff *skb,
17731783
u16 peer_id,
@@ -1839,7 +1849,7 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
18391849
bool is_decrypted;
18401850
bool is_mgmt;
18411851
u32 attention;
1842-
bool frag_pn_check = true;
1852+
bool frag_pn_check = true, multicast_check = true;
18431853

18441854
if (skb_queue_empty(amsdu))
18451855
return;
@@ -1946,13 +1956,20 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
19461956
0,
19471957
enctype);
19481958

1949-
if (!frag_pn_check) {
1950-
/* Discard the fragment with invalid PN */
1959+
if (frag)
1960+
multicast_check = ath10k_htt_rx_h_frag_multicast_check(ar,
1961+
msdu,
1962+
0);
1963+
1964+
if (!frag_pn_check || !multicast_check) {
1965+
/* Discard the fragment with invalid PN or multicast DA
1966+
*/
19511967
temp = msdu->prev;
19521968
__skb_unlink(msdu, amsdu);
19531969
dev_kfree_skb_any(msdu);
19541970
msdu = temp;
19551971
frag_pn_check = true;
1972+
multicast_check = true;
19561973
continue;
19571974
}
19581975

0 commit comments

Comments
 (0)