Skip to content

Commit 65ad3ef

Browse files
Rajkumar Manoharanjmberg-intel
authored andcommitted
mac80211: fix warning in 6 GHz IE addition in mesh mode
The commit 24a2042 ("mac80211: add HE 6 GHz Band Capability element") failed to check device capability before adding HE 6 GHz capability element. Below warning is reported in 11ac device in mesh. Fix that by checking device capability at HE 6 GHz cap IE addition in mesh beacon and association request. WARNING: CPU: 1 PID: 1897 at net/mac80211/util.c:2878 ieee80211_ie_build_he_6ghz_cap+0x149/0x150 [mac80211] [ 3138.720358] Call Trace: [ 3138.720361] ieee80211_mesh_build_beacon+0x462/0x530 [mac80211] [ 3138.720363] ieee80211_start_mesh+0xa8/0xf0 [mac80211] [ 3138.720365] __cfg80211_join_mesh+0x122/0x3e0 [cfg80211] [ 3138.720368] nl80211_join_mesh+0x3d3/0x510 [cfg80211] Fixes: 24a2042 ("mac80211: add HE 6 GHz Band Capability element") Reported-by: Markus Theil <[email protected]> Signed-off-by: Rajkumar Manoharan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 27a2145 commit 65ad3ef

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

net/mac80211/mesh.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,19 @@ int mesh_add_he_oper_ie(struct ieee80211_sub_if_data *sdata,
617617
int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata,
618618
struct sk_buff *skb)
619619
{
620+
struct ieee80211_supported_band *sband;
621+
const struct ieee80211_sband_iftype_data *iftd;
622+
623+
sband = ieee80211_get_sband(sdata);
624+
if (!sband)
625+
return -EINVAL;
626+
627+
iftd = ieee80211_get_sband_iftype_data(sband,
628+
NL80211_IFTYPE_MESH_POINT);
629+
/* The device doesn't support HE in mesh mode or at all */
630+
if (!iftd)
631+
return 0;
632+
620633
ieee80211_ie_build_he_6ghz_cap(sdata, skb);
621634
return 0;
622635
}

net/mac80211/util.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,10 @@ void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
28782878
if (WARN_ON(!iftd))
28792879
return;
28802880

2881+
/* Check for device HE 6 GHz capability before adding element */
2882+
if (!iftd->he_6ghz_capa.capa)
2883+
return;
2884+
28812885
cap = le16_to_cpu(iftd->he_6ghz_capa.capa);
28822886
cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS;
28832887

0 commit comments

Comments
 (0)