Skip to content

Commit 6b36d68

Browse files
committed
Merge tag 'wireless-2023-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless
Johannes Berg says: ==================== Just a few fixes: * fix size calculation for EHT element to put into SKBs * remove erroneous pre-RCU calls for drivers not using sta_state calls * fix mesh forwarding and non-forwarding RX * fix mesh flow dissection * fix a potential NULL dereference on A-MSDU RX w/o station * make two variable non-static that really shouldn't be static * tag 'wireless-2023-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless: wifi: mac80211: fix invalid drv_sta_pre_rcu_remove calls for non-uploaded sta wifi: mac80211: fix flow dissection for forwarded packets wifi: mac80211: fix mesh forwarding wifi: mac80211: fix receiving mesh packets in forwarding=0 networks wifi: mac80211: fix the size calculation of ieee80211_ie_len_eht_cap() wifi: mac80211: fix potential null pointer dereference wifi: mac80211: drop bogus static keywords in A-MSDU rx ==================== Link: https://lore.kernel.org/r/20230330203313.919164-1-johannes@sipsolutions.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents b2bc47e + 12b220a commit 6b36d68

3 files changed

Lines changed: 19 additions & 15 deletions

File tree

net/mac80211/rx.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,14 +2769,6 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta
27692769
if (sdata->crypto_tx_tailroom_needed_cnt)
27702770
tailroom = IEEE80211_ENCRYPT_TAILROOM;
27712771

2772-
if (!--mesh_hdr->ttl) {
2773-
if (multicast)
2774-
goto rx_accept;
2775-
2776-
IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
2777-
return RX_DROP_MONITOR;
2778-
}
2779-
27802772
if (mesh_hdr->flags & MESH_FLAGS_AE) {
27812773
struct mesh_path *mppath;
27822774
char *proxied_addr;
@@ -2807,6 +2799,14 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta
28072799
if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
28082800
goto rx_accept;
28092801

2802+
if (!--mesh_hdr->ttl) {
2803+
if (multicast)
2804+
goto rx_accept;
2805+
2806+
IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
2807+
return RX_DROP_MONITOR;
2808+
}
2809+
28102810
if (!ifmsh->mshcfg.dot11MeshForwarding) {
28112811
if (is_multicast_ether_addr(eth->h_dest))
28122812
goto rx_accept;
@@ -2833,6 +2833,9 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta
28332833

28342834
if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr)))
28352835
return RX_DROP_UNUSABLE;
2836+
2837+
if (skb_linearize(fwd_skb))
2838+
return RX_DROP_UNUSABLE;
28362839
}
28372840

28382841
fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr));
@@ -2847,7 +2850,7 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta
28472850
hdrlen += ETH_ALEN;
28482851
else
28492852
fwd_skb->protocol = htons(fwd_skb->len - hdrlen);
2850-
skb_set_network_header(fwd_skb, hdrlen);
2853+
skb_set_network_header(fwd_skb, hdrlen + 2);
28512854

28522855
info = IEEE80211_SKB_CB(fwd_skb);
28532856
memset(info, 0, sizeof(*info));
@@ -2896,7 +2899,7 @@ __ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset)
28962899
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
28972900
__le16 fc = hdr->frame_control;
28982901
struct sk_buff_head frame_list;
2899-
static ieee80211_rx_result res;
2902+
ieee80211_rx_result res;
29002903
struct ethhdr ethhdr;
29012904
const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source;
29022905

@@ -2930,7 +2933,7 @@ __ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset)
29302933
data_offset, true))
29312934
return RX_DROP_UNUSABLE;
29322935

2933-
if (rx->sta && rx->sta->amsdu_mesh_control < 0) {
2936+
if (rx->sta->amsdu_mesh_control < 0) {
29342937
bool valid_std = ieee80211_is_valid_amsdu(skb, true);
29352938
bool valid_nonstd = ieee80211_is_valid_amsdu(skb, false);
29362939

@@ -3006,7 +3009,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
30063009
}
30073010
}
30083011

3009-
if (is_multicast_ether_addr(hdr->addr1))
3012+
if (is_multicast_ether_addr(hdr->addr1) || !rx->sta)
30103013
return RX_DROP_UNUSABLE;
30113014

30123015
if (rx->key) {
@@ -3037,7 +3040,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
30373040
struct net_device *dev = sdata->dev;
30383041
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
30393042
__le16 fc = hdr->frame_control;
3040-
static ieee80211_rx_result res;
3043+
ieee80211_rx_result res;
30413044
bool port_control;
30423045
int err;
30433046

net/mac80211/sta_info.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,8 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
12641264
list_del_rcu(&sta->list);
12651265
sta->removed = true;
12661266

1267-
drv_sta_pre_rcu_remove(local, sta->sdata, sta);
1267+
if (sta->uploaded)
1268+
drv_sta_pre_rcu_remove(local, sta->sdata, sta);
12681269

12691270
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
12701271
rcu_access_pointer(sdata->u.vlan.sta) == sta)

net/mac80211/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4906,7 +4906,7 @@ u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype)
49064906
&eht_cap->eht_cap_elem,
49074907
is_ap);
49084908
return 2 + 1 +
4909-
sizeof(he_cap->he_cap_elem) + n +
4909+
sizeof(eht_cap->eht_cap_elem) + n +
49104910
ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0],
49114911
eht_cap->eht_cap_elem.phy_cap_info);
49124912
return 0;

0 commit comments

Comments
 (0)