From: Miri Korenblit Date: Mon, 29 Jan 2024 19:00:53 +0000 (+0100) Subject: wifi: mac80211: don't allow deactivation of all links X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b341590e77d89d8812051fdd2354ff04e12f211b;p=linux.git wifi: mac80211: don't allow deactivation of all links 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 Link: https://msgid.link/20240129200054.e3c113f94508.Ia35f927f914bf98dd8f9350dd4f78b1d901b1c1d@changeid Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/link.c b/net/mac80211/link.c index d4f86955afa6d..c0d05efcf6f8c 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -444,6 +444,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; @@ -472,6 +475,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;