blob: 81b201593c484818a23324e2a5a4b1803ad8ac01 [file] [log] [blame]
From 95dcf88b68837221ad937fe7c675b169c8034384 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 22 Apr 2024 08:40:18 +0800
Subject: [PATCH] mtk: hostapd: free station when hapd deinit
Free all stations in the same MLD when a bss is deinit.
Without this patch, the AP_VLAN interface may be free after
stop ap and leads to kernel crash.
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
src/ap/hostapd.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index c31e0badd..62943c561 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -842,7 +842,21 @@ static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason)
void hostapd_bss_deinit_no_free(struct hostapd_data *hapd)
{
+#ifdef CONFIG_IEEE80211BE
+ struct hostapd_data *link;
+
+ /* FIXME: free all stations to remvoe AP_VLAN interface. Allocate */
+ /* per-link structures for AP_VLAN in mac80211 and only remove single */
+ /* link here. */
+ if (hostapd_is_mld_ap(hapd)) {
+ for_each_mld_link(link, hapd)
+ hostapd_free_stas(link);
+ } else {
+ hostapd_free_stas(hapd);
+ }
+#else
hostapd_free_stas(hapd);
+#endif
hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING);
#ifdef CONFIG_WEP
hostapd_clear_wep(hapd);
--
2.18.0