mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
wifi: mac80211: add more warnings about inserting sta info
The sta info needs to be inserted before its links may be modified. Add a few warnings to prevent accidental usage of these functions. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230827135854.eeb43b3cc9e3.I5fd8236f70e64bf6268f33c883f7a878d963b83e@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
committed by
Johannes Berg
parent
5806ef25bc
commit
79aa3a09a7
@@ -2866,6 +2866,8 @@ int ieee80211_sta_allocate_link(struct sta_info *sta, unsigned int link_id)
|
||||
|
||||
lockdep_assert_wiphy(sdata->local->hw.wiphy);
|
||||
|
||||
WARN_ON(!test_sta_flag(sta, WLAN_STA_INSERTED));
|
||||
|
||||
/* must represent an MLD from the start */
|
||||
if (WARN_ON(!sta->sta.valid_links))
|
||||
return -EINVAL;
|
||||
@@ -2895,6 +2897,8 @@ void ieee80211_sta_free_link(struct sta_info *sta, unsigned int link_id)
|
||||
{
|
||||
lockdep_assert_wiphy(sta->sdata->local->hw.wiphy);
|
||||
|
||||
WARN_ON(!test_sta_flag(sta, WLAN_STA_INSERTED));
|
||||
|
||||
sta_remove_link(sta, link_id, false);
|
||||
}
|
||||
|
||||
@@ -2922,7 +2926,7 @@ int ieee80211_sta_activate_link(struct sta_info *sta, unsigned int link_id)
|
||||
|
||||
sta->sta.valid_links = new_links;
|
||||
|
||||
if (!test_sta_flag(sta, WLAN_STA_INSERTED))
|
||||
if (WARN_ON(!test_sta_flag(sta, WLAN_STA_INSERTED)))
|
||||
goto hash;
|
||||
|
||||
ieee80211_recalc_min_chandef(sdata, link_id);
|
||||
@@ -2955,7 +2959,7 @@ void ieee80211_sta_remove_link(struct sta_info *sta, unsigned int link_id)
|
||||
|
||||
sta->sta.valid_links &= ~BIT(link_id);
|
||||
|
||||
if (test_sta_flag(sta, WLAN_STA_INSERTED))
|
||||
if (!WARN_ON(!test_sta_flag(sta, WLAN_STA_INSERTED)))
|
||||
drv_change_sta_links(sdata->local, sdata, &sta->sta,
|
||||
old_links, sta->sta.valid_links);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user