[][MAC80211][WiFi6][core][fix AP mgmt not encrypted in WDS mode with PMF on]

[Description]
Fix AP mgmt not encrypted in WDS mode with PMF on.
It had already been fixed in wifi7 code base.
(https://gerrit.mediatek.inc/c/gateway/WiFi7/mac80211/backport/+/8651246)

[Release-log]
N/A

Change-Id: I533f2879fa88d4ac9f879a613ba0dcfd818e76c0
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8722833
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0027-mac80211-mtk-fix-AP-mgmt-not-encrypted-in-WDS-mode-w.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0027-mac80211-mtk-fix-AP-mgmt-not-encrypted-in-WDS-mode-w.patch
new file mode 100644
index 0000000..ab4b5cb
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0027-mac80211-mtk-fix-AP-mgmt-not-encrypted-in-WDS-mode-w.patch
@@ -0,0 +1,39 @@
+From 6729cb3a0f853e59cb67fcadad70c138967ba534 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Thu, 25 Jan 2024 14:07:23 +0800
+Subject: [PATCH] mac80211: mtk: fix AP mgmt not encrypted in WDS mode with PMF on
+
+mtk: mac80211: fix AP mgmt not encrypted in WDS mode with PMF on
+
+In ieee80211_tx_prepare(), if tx->sta is still NULL after calling
+sta_info_get(), the skb might be mgmt for WDS peer, so sta_info_get_bss()
+if called to find sta from AP_VLAN, and then interface type & 4-addr
+using is checked.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+
+---
+ net/mac80211/tx.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index e071130..6daa5a9 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -1214,6 +1214,13 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
+ 		if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) {
+ 			tx->sta = sta_info_get(sdata, hdr->addr1);
+ 			aggr_check = true;
++
++			if (!tx->sta) {
++				tx->sta = sta_info_get_bss(sdata, hdr->addr1);
++				if (!tx->sta || !tx->sta->sdata->wdev.use_4addr ||
++				    !(tx->sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN))
++					tx->sta = NULL;
++			}
+ 		}
+ 	}
+ 
+-- 
+2.25.1
+