Skip to content

Commit eebccbf

Browse files
Sarika Sharmajmberg-intel
authored andcommitted
wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
Currently, sta_set_sinfo() fails to populate link-level station info when sinfo->valid_links is initially 0 and sta->sta.valid_links has bits set for links other than link 0. This typically occurs when association happens on a non-zero link or link 0 deleted dynamically. In such cases, the for_each_valid_link(sinfo, link_id) loop only executes for link 0 and terminates early, since sinfo->valid_links remains 0. As a result, only MLD-level information is reported to userspace. Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links before entering the loop to ensure loop executes for each valid link. During iteration, mask out invalid links from sinfo->valid_links if any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id] are not present, to report only valid link information. Fixes: 505991f ("wifi: mac80211: extend support to fill link level sinfo structure") Signed-off-by: Sarika Sharma <[email protected]> Link: https://patch.msgid.link/[email protected] [clarify comment] Signed-off-by: Johannes Berg <[email protected]>
1 parent e3ac93e commit eebccbf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/mac80211/sta_info.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,16 +3207,20 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
32073207
int link_id;
32083208

32093209
ether_addr_copy(sinfo->mld_addr, sta->addr);
3210+
3211+
/* assign valid links first for iteration */
3212+
sinfo->valid_links = sta->sta.valid_links;
3213+
32103214
for_each_valid_link(sinfo, link_id) {
32113215
link_sta = wiphy_dereference(sta->local->hw.wiphy,
32123216
sta->link[link_id]);
32133217
link = wiphy_dereference(sdata->local->hw.wiphy,
32143218
sdata->link[link_id]);
32153219

3216-
if (!link_sta || !sinfo->links[link_id] || !link)
3220+
if (!link_sta || !sinfo->links[link_id] || !link) {
3221+
sinfo->valid_links &= ~BIT(link_id);
32173222
continue;
3218-
3219-
sinfo->valid_links = sta->sta.valid_links;
3223+
}
32203224
sta_set_link_sinfo(sta, sinfo->links[link_id],
32213225
link, tidstats);
32223226
}

0 commit comments

Comments
 (0)