uboot-envtools: ath79: add ZyXEL NBG6616 uboot env support
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / subsys / 600-fix-warning-in-6-ghz-ie-addition.patch
1 From 65ad3ef9fced4062dfd74e2f89443fb5ce184321 Mon Sep 17 00:00:00 2001
2 From: Rajkumar Manoharan <rmanohar@codeaurora.org>
3 Date: Wed, 1 Jul 2020 19:20:24 -0700
4 Subject: mac80211: fix warning in 6 GHz IE addition in mesh mode
5
6 The commit 24a2042cb22f ("mac80211: add HE 6 GHz Band Capability
7 element") failed to check device capability before adding HE 6 GHz
8 capability element. Below warning is reported in 11ac device in mesh.
9 Fix that by checking device capability at HE 6 GHz cap IE addition
10 in mesh beacon and association request.
11
12 WARNING: CPU: 1 PID: 1897 at net/mac80211/util.c:2878
13 ieee80211_ie_build_he_6ghz_cap+0x149/0x150 [mac80211]
14 [ 3138.720358] Call Trace:
15 [ 3138.720361] ieee80211_mesh_build_beacon+0x462/0x530 [mac80211]
16 [ 3138.720363] ieee80211_start_mesh+0xa8/0xf0 [mac80211]
17 [ 3138.720365] __cfg80211_join_mesh+0x122/0x3e0 [cfg80211]
18 [ 3138.720368] nl80211_join_mesh+0x3d3/0x510 [cfg80211]
19
20 Fixes: 24a2042cb22f ("mac80211: add HE 6 GHz Band Capability element")
21 Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
22 Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
23 Link: https://lore.kernel.org/r/1593656424-18240-1-git-send-email-rmanohar@codeaurora.org
24 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
25 ---
26 net/mac80211/mesh.c | 13 +++++++++++++
27 net/mac80211/util.c | 4 ++++
28 2 files changed, 17 insertions(+)
29
30 --- a/net/mac80211/mesh.c
31 +++ b/net/mac80211/mesh.c
32 @@ -617,6 +617,19 @@ int mesh_add_he_oper_ie(struct ieee80211
33 int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata,
34 struct sk_buff *skb)
35 {
36 + struct ieee80211_supported_band *sband;
37 + const struct ieee80211_sband_iftype_data *iftd;
38 +
39 + sband = ieee80211_get_sband(sdata);
40 + if (!sband)
41 + return -EINVAL;
42 +
43 + iftd = ieee80211_get_sband_iftype_data(sband,
44 + NL80211_IFTYPE_MESH_POINT);
45 + /* The device doesn't support HE in mesh mode or at all */
46 + if (!iftd)
47 + return 0;
48 +
49 ieee80211_ie_build_he_6ghz_cap(sdata, skb);
50 return 0;
51 }
52 --- a/net/mac80211/util.c
53 +++ b/net/mac80211/util.c
54 @@ -2878,6 +2878,10 @@ void ieee80211_ie_build_he_6ghz_cap(stru
55 if (WARN_ON(!iftd))
56 return;
57
58 + /* Check for device HE 6 GHz capability before adding element */
59 + if (!iftd->he_6ghz_capa.capa)
60 + return;
61 +
62 cap = le16_to_cpu(iftd->he_6ghz_capa.capa);
63 cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS;
64