Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
wifi: mac80211: fix potential sta-link leak
Browse files Browse the repository at this point in the history
[ Upstream commit b01a74b ]

When a station is allocated, links are added but not
set to valid yet (e.g. during connection to an AP MLD),
we might remove the station without ever marking links
valid, and leak them. Fix that.

Fixes: cb71f1d ("wifi: mac80211: add sta link addition/removal")
Signed-off-by: Johannes Berg <[email protected]>
Reviewed-by: Ilan Peer <[email protected]>
Signed-off-by: Miri Korenblit <[email protected]>
Link: https://msgid.link/20240111181514.6573998beaf8.I09ac2e1d41c80f82a5a616b8bd1d9d8dd709a6a6@changeid
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
jmberg-intel authored and gregkh committed Jan 29, 2024
1 parent 20ef68e commit 6559fe1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
int i;

for (i = 0; i < ARRAY_SIZE(sta->link); i++) {
if (!(sta->sta.valid_links & BIT(i)))
struct link_sta_info *link_sta;

link_sta = rcu_access_pointer(sta->link[i]);
if (!link_sta)
continue;

sta_remove_link(sta, i, false);
Expand Down

0 comments on commit 6559fe1

Please sign in to comment.