diff mbox series

[2/2] wifi: mac80211: don't allow deactivation of all links

Message ID 20240129200054.e3c113f94508.Ia35f927f914bf98dd8f9350dd4f78b1d901b1c1d@changeid
State New
Headers show
Series [1/2] wifi: mac80211_hwsim: enable all links only in MLO | expand

Commit Message

Johannes Berg Jan. 29, 2024, 7 p.m. UTC
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>

The set_active_links API is intended for link switching, so switching
to no links at all is not supported.
Add a warning to check that.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/link.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/net/mac80211/link.c b/net/mac80211/link.c
index 79bda7184fe8..4f19d6479bef 100644
--- a/net/mac80211/link.c
+++ b/net/mac80211/link.c
@@ -445,6 +445,9 @@  int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
 
 	lockdep_assert_wiphy(local->hw.wiphy);
 
+	if (WARN_ON(!active_links))
+		return -EINVAL;
+
 	if (!drv_can_activate_links(local, sdata, active_links))
 		return -EINVAL;
 
@@ -473,6 +476,9 @@  void ieee80211_set_active_links_async(struct ieee80211_vif *vif,
 {
 	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
 
+	if (WARN_ON(!active_links))
+		return;
+
 	if (!ieee80211_sdata_running(sdata))
 		return;