Skip to content

Commit 8cc71fc

Browse files
Nithyanantham Paramasivamjmberg-intel
authored andcommitted
wifi: cfg80211: Fix "no buffer space available" error in nl80211_get_station() for MLO
Currently, nl80211_get_station() allocates a fixed buffer size using NLMSG_DEFAULT_SIZE. In multi-link scenarios - particularly when the number of links exceeds two - this buffer size is often insufficient to accommodate complete station statistics, resulting in "no buffer space available" errors. To address this, modify nl80211_get_station() to return only accumulated station statistics and exclude per link stats. Pass a new flag (link_stats) to nl80211_send_station() to control the inclusion of per link statistics. This allows retaining detailed output with per link data in dump commands, while excluding it from other commands where it is not needed. This change modifies the handling of per link stats introduced in commit 82d7f84 ("wifi: cfg80211: extend to embed link level statistics in NL message") to enable them only for nl80211_dump_station(). Apply the same fix to cfg80211_del_sta_sinfo() by skipping per link stats to avoid buffer issues. cfg80211_new_sta() doesn't include stats and is therefore not impacted. Fixes: 82d7f84 ("wifi: cfg80211: extend to embed link level statistics in NL message") Signed-off-by: Nithyanantham Paramasivam <nithyanantham.paramasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20250905124800.1448493-1-nithyanantham.paramasivam@oss.qualcomm.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent a814c36 commit 8cc71fc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

net/wireless/nl80211.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,7 +7062,8 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
70627062
u32 seq, int flags,
70637063
struct cfg80211_registered_device *rdev,
70647064
struct net_device *dev,
7065-
const u8 *mac_addr, struct station_info *sinfo)
7065+
const u8 *mac_addr, struct station_info *sinfo,
7066+
bool link_stats)
70667067
{
70677068
void *hdr;
70687069
struct nlattr *sinfoattr, *bss_param;
@@ -7283,7 +7284,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
72837284
goto nla_put_failure;
72847285
}
72857286

7286-
if (sinfo->valid_links) {
7287+
if (link_stats && sinfo->valid_links) {
72877288
links = nla_nest_start(msg, NL80211_ATTR_MLO_LINKS);
72887289
if (!links)
72897290
goto nla_put_failure;
@@ -7574,7 +7575,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
75747575
NETLINK_CB(cb->skb).portid,
75757576
cb->nlh->nlmsg_seq, NLM_F_MULTI,
75767577
rdev, wdev->netdev, mac_addr,
7577-
&sinfo) < 0)
7578+
&sinfo, true) < 0)
75787579
goto out;
75797580

75807581
sta_idx++;
@@ -7635,7 +7636,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
76357636

76367637
if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION,
76377638
info->snd_portid, info->snd_seq, 0,
7638-
rdev, dev, mac_addr, &sinfo) < 0) {
7639+
rdev, dev, mac_addr, &sinfo, false) < 0) {
76397640
nlmsg_free(msg);
76407641
return -ENOBUFS;
76417642
}
@@ -19680,7 +19681,7 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
1968019681
return;
1968119682

1968219683
if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION, 0, 0, 0,
19683-
rdev, dev, mac_addr, sinfo) < 0) {
19684+
rdev, dev, mac_addr, sinfo, false) < 0) {
1968419685
nlmsg_free(msg);
1968519686
return;
1968619687
}
@@ -19710,7 +19711,7 @@ void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
1971019711
}
1971119712

1971219713
if (nl80211_send_station(msg, NL80211_CMD_DEL_STATION, 0, 0, 0,
19713-
rdev, dev, mac_addr, sinfo) < 0) {
19714+
rdev, dev, mac_addr, sinfo, false) < 0) {
1971419715
nlmsg_free(msg);
1971519716
return;
1971619717
}

0 commit comments

Comments
 (0)