Skip to content

Commit 5667c86

Browse files
Rajkumar Manoharanjmberg-intel
authored andcommitted
mac80211: strictly check mesh address extension mode
Mesh forwarding path checks for address extension mode to fetch appropriate proxied address and MPP address. Existing condition that looks for 6 address format is not strict enough so that frames with improper values are processed and invalid entries are added into MPP table. Fix that by adding a stricter check before processing the packet. Per IEEE Std 802.11s-2011 spec. Table 7-6g1 lists address extension mode 0x3 as reserved one. And also Table Table 9-13 does not specify 0x3 as valid address field. Fixes: 9b395bc ("mac80211: verify that skb data is present") Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 29cee56 commit 5667c86

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎net/mac80211/rx.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
24922492
if (is_multicast_ether_addr(hdr->addr1)) {
24932493
mpp_addr = hdr->addr3;
24942494
proxied_addr = mesh_hdr->eaddr1;
2495-
} else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) {
2495+
} else if ((mesh_hdr->flags & MESH_FLAGS_AE) ==
2496+
MESH_FLAGS_AE_A5_A6) {
24962497
/* has_a4 already checked in ieee80211_rx_mesh_check */
24972498
mpp_addr = hdr->addr4;
24982499
proxied_addr = mesh_hdr->eaddr2;

‎net/wireless/util.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
454454
if (iftype == NL80211_IFTYPE_MESH_POINT)
455455
skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
456456

457+
mesh_flags &= MESH_FLAGS_AE;
458+
457459
switch (hdr->frame_control &
458460
cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
459461
case cpu_to_le16(IEEE80211_FCTL_TODS):
@@ -469,9 +471,9 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
469471
iftype != NL80211_IFTYPE_STATION))
470472
return -1;
471473
if (iftype == NL80211_IFTYPE_MESH_POINT) {
472-
if (mesh_flags & MESH_FLAGS_AE_A4)
474+
if (mesh_flags == MESH_FLAGS_AE_A4)
473475
return -1;
474-
if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
476+
if (mesh_flags == MESH_FLAGS_AE_A5_A6) {
475477
skb_copy_bits(skb, hdrlen +
476478
offsetof(struct ieee80211s_hdr, eaddr1),
477479
tmp.h_dest, 2 * ETH_ALEN);
@@ -487,9 +489,9 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
487489
ether_addr_equal(tmp.h_source, addr)))
488490
return -1;
489491
if (iftype == NL80211_IFTYPE_MESH_POINT) {
490-
if (mesh_flags & MESH_FLAGS_AE_A5_A6)
492+
if (mesh_flags == MESH_FLAGS_AE_A5_A6)
491493
return -1;
492-
if (mesh_flags & MESH_FLAGS_AE_A4)
494+
if (mesh_flags == MESH_FLAGS_AE_A4)
493495
skb_copy_bits(skb, hdrlen +
494496
offsetof(struct ieee80211s_hdr, eaddr1),
495497
tmp.h_source, ETH_ALEN);

0 commit comments

Comments
 (0)