Skip to content

Commit e3561d5

Browse files
vanhoefmgregkh
authored andcommitted
mac80211: properly handle A-MSDUs that start with an RFC 1042 header
commit a1d5ff5 upstream. Properly parse A-MSDUs whose first 6 bytes happen to equal a rfc1042 header. This can occur in practice when the destination MAC address equals AA:AA:03:00:00:00. More importantly, this simplifies the next patch to mitigate A-MSDU injection attacks. Cc: stable@vger.kernel.org Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be> Link: https://lore.kernel.org/r/20210511200110.0b2b886492f0.I23dd5d685fe16d3b0ec8106e8f01b59f499dffed@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 42d98e0 commit e3561d5

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5624,7 +5624,7 @@ unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
56245624
*/
56255625
int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
56265626
const u8 *addr, enum nl80211_iftype iftype,
5627-
u8 data_offset);
5627+
u8 data_offset, bool is_amsdu);
56285628

56295629
/**
56305630
* ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
@@ -5636,7 +5636,7 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
56365636
static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
56375637
enum nl80211_iftype iftype)
56385638
{
5639-
return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
5639+
return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
56405640
}
56415641

56425642
/**

‎net/mac80211/rx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ __ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset)
26922692
if (ieee80211_data_to_8023_exthdr(skb, &ethhdr,
26932693
rx->sdata->vif.addr,
26942694
rx->sdata->vif.type,
2695-
data_offset))
2695+
data_offset, true))
26962696
return RX_DROP_UNUSABLE;
26972697

26982698
ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,

‎net/wireless/util.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
541541

542542
int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
543543
const u8 *addr, enum nl80211_iftype iftype,
544-
u8 data_offset)
544+
u8 data_offset, bool is_amsdu)
545545
{
546546
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
547547
struct {
@@ -629,7 +629,7 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
629629
skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
630630
tmp.h_proto = payload.proto;
631631

632-
if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
632+
if (likely((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) &&
633633
tmp.h_proto != htons(ETH_P_AARP) &&
634634
tmp.h_proto != htons(ETH_P_IPX)) ||
635635
ether_addr_equal(payload.hdr, bridge_tunnel_header)))

0 commit comments

Comments
 (0)