--- /dev/null
+From 65ad3ef9fced4062dfd74e2f89443fb5ce184321 Mon Sep 17 00:00:00 2001
+From: Rajkumar Manoharan <rmanohar@codeaurora.org>
+Date: Wed, 1 Jul 2020 19:20:24 -0700
+Subject: mac80211: fix warning in 6 GHz IE addition in mesh mode
+
+The commit 24a2042cb22f ("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: 24a2042cb22f ("mac80211: add HE 6 GHz Band Capability element")
+Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
+Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
+Link: https://lore.kernel.org/r/1593656424-18240-1-git-send-email-rmanohar@codeaurora.org
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+ net/mac80211/mesh.c | 13 +++++++++++++
+ net/mac80211/util.c | 4 ++++
+ 2 files changed, 17 insertions(+)
+
+--- a/net/mac80211/mesh.c
++++ b/net/mac80211/mesh.c
+@@ -617,6 +617,19 @@ int mesh_add_he_oper_ie(struct ieee80211
+ int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb)
+ {
++ struct ieee80211_supported_band *sband;
++ const struct ieee80211_sband_iftype_data *iftd;
++
++ sband = ieee80211_get_sband(sdata);
++ if (!sband)
++ return -EINVAL;
++
++ iftd = ieee80211_get_sband_iftype_data(sband,
++ NL80211_IFTYPE_MESH_POINT);
++ /* The device doesn't support HE in mesh mode or at all */
++ if (!iftd)
++ return 0;
++
+ ieee80211_ie_build_he_6ghz_cap(sdata, skb);
+ return 0;
+ }
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
+@@ -2878,6 +2878,10 @@ void ieee80211_ie_build_he_6ghz_cap(stru
+ if (WARN_ON(!iftd))
+ return;
+
++ /* Check for device HE 6 GHz capability before adding element */
++ if (!iftd->he_6ghz_capa.capa)
++ return;
++
+ cap = le16_to_cpu(iftd->he_6ghz_capa.capa);
+ cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS;
+
+++ /dev/null
-From db6d1e942f5a2828e1245e16ceb997f537a2d1a4 Mon Sep 17 00:00:00 2001
-From: David Bauer <mail@david-bauer.net>
-Date: Sat, 25 Jul 2020 01:43:26 +0200
-Subject: [PATCH] mac80211: util: don't warn on missing sband iftype data
-
-The kernel currently floods the ringbuffer with warnings when adding a
-mesh interface for a device not support HE 6GHz modes.
-
-Return without warning in this case, as mesh_add_he_6ghz_cap_ie calls
-ieee80211_ie_build_he_6ghz_cap regardless of the supported interface
-modes.
-
-Signed-off-by: David Bauer <mail@david-bauer.net>
----
- net/mac80211/util.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/net/mac80211/util.c
-+++ b/net/mac80211/util.c
-@@ -2875,7 +2875,7 @@ void ieee80211_ie_build_he_6ghz_cap(stru
- return;
-
- iftd = ieee80211_get_sband_iftype_data(sband, iftype);
-- if (WARN_ON(!iftd))
-+ if (!iftd)
- return;
-
- cap = le16_to_cpu(iftd->he_6ghz_capa.capa);