Skip to content

Commit b01a74b

Browse files
committed
wifi: mac80211: fix potential sta-link leak
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 <johannes.berg@intel.com> Reviewed-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240111181514.6573998beaf8.I09ac2e1d41c80f82a5a616b8bd1d9d8dd709a6a6@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 26490da commit b01a74b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/mac80211/sta_info.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
404404
int i;
405405

406406
for (i = 0; i < ARRAY_SIZE(sta->link); i++) {
407-
if (!(sta->sta.valid_links & BIT(i)))
407+
struct link_sta_info *link_sta;
408+
409+
link_sta = rcu_access_pointer(sta->link[i]);
410+
if (!link_sta)
408411
continue;
409412

410413
sta_remove_link(sta, i, false);

0 commit comments

Comments
 (0)